diff --git a/eng/mgmt/automation/parameters.py b/eng/mgmt/automation/parameters.py index a834f8527f07..61e8ba1997b1 100644 --- a/eng/mgmt/automation/parameters.py +++ b/eng/mgmt/automation/parameters.py @@ -15,7 +15,7 @@ MAVEN_URL = 'https://repo1.maven.org/maven2/{group_id}/{artifact_id}/{version}/{artifact_id}-{version}.jar' SDK_ROOT = '../../../' # related to file dir -AUTOREST_CORE_VERSION = '3.1.3' +AUTOREST_CORE_VERSION = '3.4.5' AUTOREST_JAVA = '@autorest/java@4.0.32' DEFAULT_VERSION = '1.0.0-beta.1' GROUP_ID = 'com.azure.resourcemanager' diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 1eb74aa342c1..90833e330845 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -305,6 +305,7 @@ com.azure.resourcemanager:azure-resourcemanager-deviceprovisioningservices;1.0.0 com.azure.resourcemanager:azure-resourcemanager-postgresqlflexibleserver;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-elastic;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-webpubsub;1.0.0-beta.1;1.0.0-beta.2 +com.azure.resourcemanager:azure-resourcemanager-security;1.0.0-beta.1;1.0.0-beta.1 # Unreleased dependencies: Copy the entry from above, prepend "unreleased_" and remove the current # version. Unreleased dependencies are only valid for dependency versions. diff --git a/pom.xml b/pom.xml index d50033058ed5..0c475ccdb3e4 100644 --- a/pom.xml +++ b/pom.xml @@ -804,6 +804,7 @@ sdk/resourcemover sdk/schemaregistry sdk/search + sdk/security sdk/servicebus sdk/servicefabric sdk/signalr diff --git a/sdk/security/azure-resourcemanager-security/CHANGELOG.md b/sdk/security/azure-resourcemanager-security/CHANGELOG.md new file mode 100644 index 000000000000..524635797c38 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2021-07-14) + +- Azure Resource Manager Security client library for Java. This package contains Microsoft Azure SDK for Security Management SDK. API spec for Microsoft.Security (Azure Security Center) resource provider. Package tag package-composite-v3. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). diff --git a/sdk/security/azure-resourcemanager-security/README.md b/sdk/security/azure-resourcemanager-security/README.md new file mode 100644 index 000000000000..dae5056f7c71 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/README.md @@ -0,0 +1,102 @@ +# Azure Resource Manager Security client library for Java + +Azure Resource Manager Security client library for Java. + +This package contains Microsoft Azure SDK for Security Management SDK. API spec for Microsoft.Security (Azure Security Center) resource provider. Package tag package-composite-v3. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). + +## We'd love to hear your feedback + +We're always working on improving our products and the way we communicate with our users. So we'd love to learn what's working and how we can do better. + +If you haven't already, please take a few minutes to [complete this short survey][survey] we have put together. + +Thank you in advance for your collaboration. We really appreciate your time! + +## Documentation + +Various documentation is available to help you get started + +- [API reference documentation][docs] + +## Getting started + +### Prerequisites + +- [Java Development Kit (JDK)][jdk] with version 8 or above +- [Azure Subscription][azure_subscription] + +### Adding the package to your product + +[//]: # ({x-version-update-start;com.azure.resourcemanager:azure-resourcemanager-security;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-security + 1.0.0-beta.1 + +``` +[//]: # ({x-version-update-end}) + +### Include the recommended packages + +Azure Management Libraries require a `TokenCredential` implementation for authentication and an `HttpClient` implementation for HTTP client. + +[Azure Identity][azure_identity] package and [Azure Core Netty HTTP][azure_core_http_netty] package provide the default implementation. + +### Authentication + +By default, Azure Active Directory token authentication depends on correct configure of following environment variables. + +- `AZURE_CLIENT_ID` for Azure client ID. +- `AZURE_TENANT_ID` for Azure tenant ID. +- `AZURE_CLIENT_SECRET` or `AZURE_CLIENT_CERTIFICATE_PATH` for client secret or client certificate. + +In addition, Azure subscription ID can be configured via environment variable `AZURE_SUBSCRIPTION_ID`. + +With above configuration, `azure` client can be authenticated by following code: + +```java +AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE); +TokenCredential credential = new DefaultAzureCredentialBuilder() + .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint()) + .build(); +SecurityManager manager = SecurityManager + .authenticate(credential, profile); +``` + +The sample code assumes global Azure. Please change `AzureEnvironment.AZURE` variable if otherwise. + +See [Authentication][authenticate] for more options. + +## Key concepts + +See [API design][design] for general introduction on design and key concepts on Azure Management Libraries. + +## Examples + +[Code snippets and samples](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/SAMPLE.md) + + +## Troubleshooting + +## Next steps + +## Contributing + +For details on contributing to this repository, see the [contributing guide](https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md). + +1. Fork it +1. Create your feature branch (`git checkout -b my-new-feature`) +1. Commit your changes (`git commit -am 'Add some feature'`) +1. Push to the branch (`git push origin my-new-feature`) +1. Create new Pull Request + + +[survey]: https://microsoft.qualtrics.com/jfe/form/SV_ehN0lIk2FKEBkwd?Q_CHL=DOCS +[docs]: https://azure.github.io/azure-sdk-for-java/ +[jdk]: https://docs.microsoft.com/java/azure/jdk/ +[azure_subscription]: https://azure.microsoft.com/free/ +[azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/identity/azure-identity +[azure_core_http_netty]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/core/azure-core-http-netty +[authenticate]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/AUTH.md +[design]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/DESIGN.md diff --git a/sdk/security/azure-resourcemanager-security/SAMPLE.md b/sdk/security/azure-resourcemanager-security/SAMPLE.md new file mode 100644 index 000000000000..0fe03d7c6216 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/SAMPLE.md @@ -0,0 +1,360 @@ +# Code snippets and samples + + +### AdaptiveApplicationControls + +- [Delete](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AdaptiveApplicationControlsDeleteSamples.java) +- [Get](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AdaptiveApplicationControlsGetSamples.java) +- [List](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AdaptiveApplicationControlsListSamples.java) +- [Put](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AdaptiveApplicationControlsPutSamples.java) + +### AdaptiveNetworkHardenings + +- [Enforce](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AdaptiveNetworkHardeningsEnforceSamples.java) +- [Get](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AdaptiveNetworkHardeningsGetSamples.java) +- [ListByExtendedResource](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AdaptiveNetworkHardeningsListByExtendedResourceSamples.java) + +### AdvancedThreatProtection + +- [Create](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AdvancedThreatProtectionCreateSamples.java) +- [Get](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AdvancedThreatProtectionGetSamples.java) + +### Alerts + +- [GetResourceGroupLevel](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AlertsGetResourceGroupLevelSamples.java) +- [GetSubscriptionLevel](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AlertsGetSubscriptionLevelSamples.java) +- [List](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AlertsListSamples.java) +- [ListByResourceGroup](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AlertsListByResourceGroupSamples.java) +- [ListResourceGroupLevelByRegion](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AlertsListResourceGroupLevelByRegionSamples.java) +- [ListSubscriptionLevelByRegion](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AlertsListSubscriptionLevelByRegionSamples.java) +- [Simulate](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AlertsSimulateSamples.java) +- [UpdateResourceGroupLevelStateToActivate](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AlertsUpdateResourceGroupLevelStateToActivateSamples.java) +- [UpdateResourceGroupLevelStateToDismiss](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AlertsUpdateResourceGroupLevelStateToDismissSamples.java) +- [UpdateResourceGroupLevelStateToResolve](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AlertsUpdateResourceGroupLevelStateToResolveSamples.java) +- [UpdateSubscriptionLevelStateToActivate](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AlertsUpdateSubscriptionLevelStateToActivateSamples.java) +- [UpdateSubscriptionLevelStateToDismiss](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AlertsUpdateSubscriptionLevelStateToDismissSamples.java) +- [UpdateSubscriptionLevelStateToResolve](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AlertsUpdateSubscriptionLevelStateToResolveSamples.java) + +### AlertsSuppressionRules + +- [Delete](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AlertsSuppressionRulesDeleteSamples.java) +- [Get](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AlertsSuppressionRulesGetSamples.java) +- [List](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AlertsSuppressionRulesListSamples.java) +- [Update](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AlertsSuppressionRulesUpdateSamples.java) + +### AllowedConnections + +- [Get](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AllowedConnectionsGetSamples.java) +- [List](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AllowedConnectionsListSamples.java) +- [ListByHomeRegion](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AllowedConnectionsListByHomeRegionSamples.java) + +### Assessments + +- [CreateOrUpdate](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AssessmentsCreateOrUpdateSamples.java) +- [Delete](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AssessmentsDeleteSamples.java) +- [Get](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AssessmentsGetSamples.java) +- [List](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AssessmentsListSamples.java) + +### AssessmentsMetadata + +- [CreateInSubscription](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AssessmentsMetadataCreateInSubscriptionSamples.java) +- [DeleteInSubscription](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AssessmentsMetadataDeleteInSubscriptionSamples.java) +- [Get](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AssessmentsMetadataGetSamples.java) +- [GetInSubscription](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AssessmentsMetadataGetInSubscriptionSamples.java) +- [List](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AssessmentsMetadataListSamples.java) +- [ListBySubscription](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AssessmentsMetadataListBySubscriptionSamples.java) + +### AutoProvisioningSettings + +- [Create](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AutoProvisioningSettingsCreateSamples.java) +- [Get](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AutoProvisioningSettingsGetSamples.java) +- [List](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AutoProvisioningSettingsListSamples.java) + +### Automations + +- [CreateOrUpdate](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AutomationsCreateOrUpdateSamples.java) +- [Delete](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AutomationsDeleteSamples.java) +- [GetByResourceGroup](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AutomationsGetByResourceGroupSamples.java) +- [List](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AutomationsListSamples.java) +- [ListByResourceGroup](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AutomationsListByResourceGroupSamples.java) +- [Validate](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AutomationsValidateSamples.java) + +### ComplianceResults + +- [Get](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/ComplianceResultsGetSamples.java) +- [List](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/ComplianceResultsListSamples.java) + +### Compliances + +- [Get](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/CompliancesGetSamples.java) +- [List](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/CompliancesListSamples.java) + +### Connectors + +- [CreateOrUpdate](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/ConnectorsCreateOrUpdateSamples.java) +- [Delete](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/ConnectorsDeleteSamples.java) +- [Get](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/ConnectorsGetSamples.java) +- [List](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/ConnectorsListSamples.java) + +### Device + +- [Get](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/DeviceGetSamples.java) + +### DeviceSecurityGroups + +- [CreateOrUpdate](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/DeviceSecurityGroupsCreateOrUpdateSamples.java) +- [Delete](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/DeviceSecurityGroupsDeleteSamples.java) +- [Get](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/DeviceSecurityGroupsGetSamples.java) +- [List](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/DeviceSecurityGroupsListSamples.java) + +### DevicesForHub + +- [List](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/DevicesForHubListSamples.java) + +### DevicesForSubscription + +- [List](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/DevicesForSubscriptionListSamples.java) + +### DiscoveredSecuritySolutions + +- [Get](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/DiscoveredSecuritySolutionsGetSamples.java) +- [List](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/DiscoveredSecuritySolutionsListSamples.java) +- [ListByHomeRegion](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/DiscoveredSecuritySolutionsListByHomeRegionSamples.java) + +### ExternalSecuritySolutions + +- [Get](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/ExternalSecuritySolutionsGetSamples.java) +- [List](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/ExternalSecuritySolutionsListSamples.java) +- [ListByHomeRegion](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/ExternalSecuritySolutionsListByHomeRegionSamples.java) + +### InformationProtectionPolicies + +- [CreateOrUpdate](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/InformationProtectionPoliciesCreateOrUpdateSamples.java) +- [Get](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/InformationProtectionPoliciesGetSamples.java) +- [List](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/InformationProtectionPoliciesListSamples.java) + +### IngestionSettings + +- [Create](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IngestionSettingsCreateSamples.java) +- [Delete](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IngestionSettingsDeleteSamples.java) +- [Get](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IngestionSettingsGetSamples.java) +- [List](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IngestionSettingsListSamples.java) +- [ListConnectionStrings](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IngestionSettingsListConnectionStringsSamples.java) +- [ListTokens](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IngestionSettingsListTokensSamples.java) + +### IotAlertTypes + +- [Get](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotAlertTypesGetSamples.java) +- [List](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotAlertTypesListSamples.java) + +### IotAlerts + +- [Get](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotAlertsGetSamples.java) +- [List](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotAlertsListSamples.java) + +### IotDefenderSettings + +- [CreateOrUpdate](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotDefenderSettingsCreateOrUpdateSamples.java) +- [Delete](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotDefenderSettingsDeleteSamples.java) +- [DownloadManagerActivation](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotDefenderSettingsDownloadManagerActivationSamples.java) +- [Get](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotDefenderSettingsGetSamples.java) +- [List](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotDefenderSettingsListSamples.java) +- [PackageDownloads](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotDefenderSettingsPackageDownloadsSamples.java) + +### IotRecommendationTypes + +- [Get](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotRecommendationTypesGetSamples.java) +- [List](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotRecommendationTypesListSamples.java) + +### IotRecommendations + +- [Get](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotRecommendationsGetSamples.java) +- [List](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotRecommendationsListSamples.java) + +### IotSecuritySolution + +- [CreateOrUpdate](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotSecuritySolutionCreateOrUpdateSamples.java) +- [Delete](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotSecuritySolutionDeleteSamples.java) +- [GetByResourceGroup](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotSecuritySolutionGetByResourceGroupSamples.java) +- [List](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotSecuritySolutionListSamples.java) +- [ListByResourceGroup](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotSecuritySolutionListByResourceGroupSamples.java) +- [Update](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotSecuritySolutionUpdateSamples.java) + +### IotSecuritySolutionAnalytics + +- [Get](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotSecuritySolutionAnalyticsGetSamples.java) +- [List](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotSecuritySolutionAnalyticsListSamples.java) + +### IotSecuritySolutionsAnalyticsAggregatedAlert + +- [Dismiss](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotSecuritySolutionsAnalyticsAggregatedAlertDismissSamples.java) +- [Get](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotSecuritySolutionsAnalyticsAggregatedAlertGetSamples.java) +- [List](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotSecuritySolutionsAnalyticsAggregatedAlertListSamples.java) + +### IotSecuritySolutionsAnalyticsRecommendation + +- [Get](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotSecuritySolutionsAnalyticsRecommendationGetSamples.java) +- [List](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotSecuritySolutionsAnalyticsRecommendationListSamples.java) + +### IotSensors + +- [CreateOrUpdate](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotSensorsCreateOrUpdateSamples.java) +- [Delete](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotSensorsDeleteSamples.java) +- [DownloadActivation](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotSensorsDownloadActivationSamples.java) +- [DownloadResetPassword](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotSensorsDownloadResetPasswordSamples.java) +- [Get](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotSensorsGetSamples.java) +- [List](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotSensorsListSamples.java) +- [TriggerTiPackageUpdate](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotSensorsTriggerTiPackageUpdateSamples.java) + +### IotSites + +- [CreateOrUpdate](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotSitesCreateOrUpdateSamples.java) +- [Delete](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotSitesDeleteSamples.java) +- [Get](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotSitesGetSamples.java) +- [List](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotSitesListSamples.java) + +### JitNetworkAccessPolicies + +- [CreateOrUpdate](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/JitNetworkAccessPoliciesCreateOrUpdateSamples.java) +- [Delete](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/JitNetworkAccessPoliciesDeleteSamples.java) +- [Get](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/JitNetworkAccessPoliciesGetSamples.java) +- [Initiate](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/JitNetworkAccessPoliciesInitiateSamples.java) +- [List](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/JitNetworkAccessPoliciesListSamples.java) +- [ListByRegion](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/JitNetworkAccessPoliciesListByRegionSamples.java) +- [ListByResourceGroup](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/JitNetworkAccessPoliciesListByResourceGroupSamples.java) +- [ListByResourceGroupAndRegion](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/JitNetworkAccessPoliciesListByResourceGroupAndRegionSamples.java) + +### Locations + +- [Get](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/LocationsGetSamples.java) +- [List](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/LocationsListSamples.java) + +### OnPremiseIotSensors + +- [CreateOrUpdate](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/OnPremiseIotSensorsCreateOrUpdateSamples.java) +- [Delete](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/OnPremiseIotSensorsDeleteSamples.java) +- [DownloadActivation](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/OnPremiseIotSensorsDownloadActivationSamples.java) +- [DownloadResetPassword](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/OnPremiseIotSensorsDownloadResetPasswordSamples.java) +- [Get](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/OnPremiseIotSensorsGetSamples.java) +- [List](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/OnPremiseIotSensorsListSamples.java) + +### Pricings + +- [Get](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/PricingsGetSamples.java) +- [List](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/PricingsListSamples.java) +- [Update](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/PricingsUpdateSamples.java) + +### RegulatoryComplianceAssessments + +- [Get](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/RegulatoryComplianceAssessmentsGetSamples.java) +- [List](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/RegulatoryComplianceAssessmentsListSamples.java) + +### RegulatoryComplianceControls + +- [Get](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/RegulatoryComplianceControlsGetSamples.java) +- [List](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/RegulatoryComplianceControlsListSamples.java) + +### RegulatoryComplianceStandards + +- [Get](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/RegulatoryComplianceStandardsGetSamples.java) +- [List](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/RegulatoryComplianceStandardsListSamples.java) + +### SecureScoreControlDefinitions + +- [List](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SecureScoreControlDefinitionsListSamples.java) +- [ListBySubscription](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SecureScoreControlDefinitionsListBySubscriptionSamples.java) + +### SecureScoreControls + +- [List](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SecureScoreControlsListSamples.java) +- [ListBySecureScore](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SecureScoreControlsListBySecureScoreSamples.java) + +### SecureScores + +- [Get](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SecureScoresGetSamples.java) +- [List](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SecureScoresListSamples.java) + +### SecurityContacts + +- [Create](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SecurityContactsCreateSamples.java) +- [Delete](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SecurityContactsDeleteSamples.java) +- [Get](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SecurityContactsGetSamples.java) +- [List](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SecurityContactsListSamples.java) +- [Update](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SecurityContactsUpdateSamples.java) + +### SecuritySolutions + +- [Get](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SecuritySolutionsGetSamples.java) +- [List](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SecuritySolutionsListSamples.java) + +### SecuritySolutionsReferenceData + +- [List](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SecuritySolutionsReferenceDataListSamples.java) +- [ListByHomeRegion](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SecuritySolutionsReferenceDataListByHomeRegionSamples.java) + +### ServerVulnerabilityAssessment + +- [CreateOrUpdate](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/ServerVulnerabilityAssessmentCreateOrUpdateSamples.java) +- [Delete](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/ServerVulnerabilityAssessmentDeleteSamples.java) +- [Get](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/ServerVulnerabilityAssessmentGetSamples.java) +- [ListByExtendedResource](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/ServerVulnerabilityAssessmentListByExtendedResourceSamples.java) + +### Settings + +- [Get](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SettingsGetSamples.java) +- [List](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SettingsListSamples.java) +- [Update](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SettingsUpdateSamples.java) + +### SoftwareInventories + +- [Get](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SoftwareInventoriesGetSamples.java) +- [List](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SoftwareInventoriesListSamples.java) +- [ListByExtendedResource](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SoftwareInventoriesListByExtendedResourceSamples.java) + +### SqlVulnerabilityAssessmentBaselineRules + +- [Add](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SqlVulnerabilityAssessmentBaselineRulesAddSamples.java) +- [CreateOrUpdate](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SqlVulnerabilityAssessmentBaselineRulesCreateOrUpdateSamples.java) +- [Delete](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SqlVulnerabilityAssessmentBaselineRulesDeleteSamples.java) +- [Get](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SqlVulnerabilityAssessmentBaselineRulesGetSamples.java) +- [List](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SqlVulnerabilityAssessmentBaselineRulesListSamples.java) + +### SqlVulnerabilityAssessmentScanResults + +- [Get](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SqlVulnerabilityAssessmentScanResultsGetSamples.java) +- [List](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SqlVulnerabilityAssessmentScanResultsListSamples.java) + +### SqlVulnerabilityAssessmentScans + +- [Get](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SqlVulnerabilityAssessmentScansGetSamples.java) +- [List](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SqlVulnerabilityAssessmentScansListSamples.java) + +### SubAssessments + +- [Get](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SubAssessmentsGetSamples.java) +- [List](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SubAssessmentsListSamples.java) +- [ListAll](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SubAssessmentsListAllSamples.java) + +### Tasks + +- [GetResourceGroupLevelTask](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/TasksGetResourceGroupLevelTaskSamples.java) +- [GetSubscriptionLevelTask](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/TasksGetSubscriptionLevelTaskSamples.java) +- [List](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/TasksListSamples.java) +- [ListByHomeRegion](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/TasksListByHomeRegionSamples.java) +- [ListByResourceGroup](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/TasksListByResourceGroupSamples.java) +- [UpdateResourceGroupLevelTaskState](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/TasksUpdateResourceGroupLevelTaskStateSamples.java) +- [UpdateSubscriptionLevelTaskState](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/TasksUpdateSubscriptionLevelTaskStateSamples.java) + +### Topology + +- [Get](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/TopologyGetSamples.java) +- [List](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/TopologyListSamples.java) +- [ListByHomeRegion](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/TopologyListByHomeRegionSamples.java) + +### WorkspaceSettings + +- [Create](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/WorkspaceSettingsCreateSamples.java) +- [Delete](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/WorkspaceSettingsDeleteSamples.java) +- [Get](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/WorkspaceSettingsGetSamples.java) +- [List](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/WorkspaceSettingsListSamples.java) +- [Update](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/WorkspaceSettingsUpdateSamples.java) diff --git a/sdk/security/azure-resourcemanager-security/pom.xml b/sdk/security/azure-resourcemanager-security/pom.xml new file mode 100644 index 000000000000..6605e87abf23 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/pom.xml @@ -0,0 +1,86 @@ + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure.resourcemanager + azure-resourcemanager-security + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for Security Management + This package contains Microsoft Azure SDK for Security Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. API spec for Microsoft.Security (Azure Security Center) resource provider. Package tag package-composite-v3. + https://github.com/Azure/azure-sdk-for-java + + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + + https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + + microsoft + Microsoft + + + + UTF-8 + + + + + com.azure + azure-core + 1.18.0 + + + com.azure + azure-core-management + 1.3.1 + + + + + + org.jacoco + jacoco-maven-plugin + 0.8.5 + + true + + + + org.revapi + revapi-maven-plugin + 0.11.2 + + + + + java.method.addedToInterface + + + true + .* + com\.azure\.resourcemanager(\.[^.]+)+\.fluent(\.[^.]+)* + + + + + + + + diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/SecurityManager.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/SecurityManager.java new file mode 100644 index 000000000000..cdcf2fc45d00 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/SecurityManager.java @@ -0,0 +1,914 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.credential.TokenCredential; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.http.policy.HttpLoggingPolicy; +import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.http.policy.HttpPolicyProviders; +import com.azure.core.http.policy.RequestIdPolicy; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.http.policy.ArmChallengeAuthenticationPolicy; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.util.Configuration; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.SecurityCenter; +import com.azure.resourcemanager.security.implementation.AdaptiveApplicationControlsImpl; +import com.azure.resourcemanager.security.implementation.AdaptiveNetworkHardeningsImpl; +import com.azure.resourcemanager.security.implementation.AdvancedThreatProtectionsImpl; +import com.azure.resourcemanager.security.implementation.AlertsImpl; +import com.azure.resourcemanager.security.implementation.AlertsSuppressionRulesImpl; +import com.azure.resourcemanager.security.implementation.AllowedConnectionsImpl; +import com.azure.resourcemanager.security.implementation.AssessmentsImpl; +import com.azure.resourcemanager.security.implementation.AssessmentsMetadatasImpl; +import com.azure.resourcemanager.security.implementation.AutoProvisioningSettingsImpl; +import com.azure.resourcemanager.security.implementation.AutomationsImpl; +import com.azure.resourcemanager.security.implementation.ComplianceResultsImpl; +import com.azure.resourcemanager.security.implementation.CompliancesImpl; +import com.azure.resourcemanager.security.implementation.ConnectorsImpl; +import com.azure.resourcemanager.security.implementation.DeviceSecurityGroupsImpl; +import com.azure.resourcemanager.security.implementation.DevicesForHubsImpl; +import com.azure.resourcemanager.security.implementation.DevicesForSubscriptionsImpl; +import com.azure.resourcemanager.security.implementation.DevicesImpl; +import com.azure.resourcemanager.security.implementation.DiscoveredSecuritySolutionsImpl; +import com.azure.resourcemanager.security.implementation.ExternalSecuritySolutionsImpl; +import com.azure.resourcemanager.security.implementation.InformationProtectionPoliciesImpl; +import com.azure.resourcemanager.security.implementation.IngestionSettingsImpl; +import com.azure.resourcemanager.security.implementation.IotAlertTypesImpl; +import com.azure.resourcemanager.security.implementation.IotAlertsImpl; +import com.azure.resourcemanager.security.implementation.IotDefenderSettingsImpl; +import com.azure.resourcemanager.security.implementation.IotRecommendationTypesImpl; +import com.azure.resourcemanager.security.implementation.IotRecommendationsImpl; +import com.azure.resourcemanager.security.implementation.IotSecuritySolutionAnalyticsImpl; +import com.azure.resourcemanager.security.implementation.IotSecuritySolutionsAnalyticsAggregatedAlertsImpl; +import com.azure.resourcemanager.security.implementation.IotSecuritySolutionsAnalyticsRecommendationsImpl; +import com.azure.resourcemanager.security.implementation.IotSecuritySolutionsImpl; +import com.azure.resourcemanager.security.implementation.IotSensorsImpl; +import com.azure.resourcemanager.security.implementation.IotSitesImpl; +import com.azure.resourcemanager.security.implementation.JitNetworkAccessPoliciesImpl; +import com.azure.resourcemanager.security.implementation.LocationsImpl; +import com.azure.resourcemanager.security.implementation.OnPremiseIotSensorsImpl; +import com.azure.resourcemanager.security.implementation.OperationsImpl; +import com.azure.resourcemanager.security.implementation.PricingsImpl; +import com.azure.resourcemanager.security.implementation.RegulatoryComplianceAssessmentsImpl; +import com.azure.resourcemanager.security.implementation.RegulatoryComplianceControlsImpl; +import com.azure.resourcemanager.security.implementation.RegulatoryComplianceStandardsImpl; +import com.azure.resourcemanager.security.implementation.SecureScoreControlDefinitionsImpl; +import com.azure.resourcemanager.security.implementation.SecureScoreControlsImpl; +import com.azure.resourcemanager.security.implementation.SecureScoresImpl; +import com.azure.resourcemanager.security.implementation.SecurityCenterBuilder; +import com.azure.resourcemanager.security.implementation.SecurityContactsImpl; +import com.azure.resourcemanager.security.implementation.SecuritySolutionsImpl; +import com.azure.resourcemanager.security.implementation.SecuritySolutionsReferenceDatasImpl; +import com.azure.resourcemanager.security.implementation.ServerVulnerabilityAssessmentsImpl; +import com.azure.resourcemanager.security.implementation.SettingsImpl; +import com.azure.resourcemanager.security.implementation.SoftwareInventoriesImpl; +import com.azure.resourcemanager.security.implementation.SqlVulnerabilityAssessmentBaselineRulesImpl; +import com.azure.resourcemanager.security.implementation.SqlVulnerabilityAssessmentScanResultsImpl; +import com.azure.resourcemanager.security.implementation.SqlVulnerabilityAssessmentScansImpl; +import com.azure.resourcemanager.security.implementation.SubAssessmentsImpl; +import com.azure.resourcemanager.security.implementation.TasksImpl; +import com.azure.resourcemanager.security.implementation.TopologiesImpl; +import com.azure.resourcemanager.security.implementation.WorkspaceSettingsImpl; +import com.azure.resourcemanager.security.models.AdaptiveApplicationControls; +import com.azure.resourcemanager.security.models.AdaptiveNetworkHardenings; +import com.azure.resourcemanager.security.models.AdvancedThreatProtections; +import com.azure.resourcemanager.security.models.Alerts; +import com.azure.resourcemanager.security.models.AlertsSuppressionRules; +import com.azure.resourcemanager.security.models.AllowedConnections; +import com.azure.resourcemanager.security.models.Assessments; +import com.azure.resourcemanager.security.models.AssessmentsMetadatas; +import com.azure.resourcemanager.security.models.AutoProvisioningSettings; +import com.azure.resourcemanager.security.models.Automations; +import com.azure.resourcemanager.security.models.ComplianceResults; +import com.azure.resourcemanager.security.models.Compliances; +import com.azure.resourcemanager.security.models.Connectors; +import com.azure.resourcemanager.security.models.DeviceSecurityGroups; +import com.azure.resourcemanager.security.models.Devices; +import com.azure.resourcemanager.security.models.DevicesForHubs; +import com.azure.resourcemanager.security.models.DevicesForSubscriptions; +import com.azure.resourcemanager.security.models.DiscoveredSecuritySolutions; +import com.azure.resourcemanager.security.models.ExternalSecuritySolutions; +import com.azure.resourcemanager.security.models.InformationProtectionPolicies; +import com.azure.resourcemanager.security.models.IngestionSettings; +import com.azure.resourcemanager.security.models.IotAlertTypes; +import com.azure.resourcemanager.security.models.IotAlerts; +import com.azure.resourcemanager.security.models.IotDefenderSettings; +import com.azure.resourcemanager.security.models.IotRecommendationTypes; +import com.azure.resourcemanager.security.models.IotRecommendations; +import com.azure.resourcemanager.security.models.IotSecuritySolutionAnalytics; +import com.azure.resourcemanager.security.models.IotSecuritySolutions; +import com.azure.resourcemanager.security.models.IotSecuritySolutionsAnalyticsAggregatedAlerts; +import com.azure.resourcemanager.security.models.IotSecuritySolutionsAnalyticsRecommendations; +import com.azure.resourcemanager.security.models.IotSensors; +import com.azure.resourcemanager.security.models.IotSites; +import com.azure.resourcemanager.security.models.JitNetworkAccessPolicies; +import com.azure.resourcemanager.security.models.Locations; +import com.azure.resourcemanager.security.models.OnPremiseIotSensors; +import com.azure.resourcemanager.security.models.Operations; +import com.azure.resourcemanager.security.models.Pricings; +import com.azure.resourcemanager.security.models.RegulatoryComplianceAssessments; +import com.azure.resourcemanager.security.models.RegulatoryComplianceControls; +import com.azure.resourcemanager.security.models.RegulatoryComplianceStandards; +import com.azure.resourcemanager.security.models.SecureScoreControlDefinitions; +import com.azure.resourcemanager.security.models.SecureScoreControls; +import com.azure.resourcemanager.security.models.SecureScores; +import com.azure.resourcemanager.security.models.SecurityContacts; +import com.azure.resourcemanager.security.models.SecuritySolutions; +import com.azure.resourcemanager.security.models.SecuritySolutionsReferenceDatas; +import com.azure.resourcemanager.security.models.ServerVulnerabilityAssessments; +import com.azure.resourcemanager.security.models.Settings; +import com.azure.resourcemanager.security.models.SoftwareInventories; +import com.azure.resourcemanager.security.models.SqlVulnerabilityAssessmentBaselineRules; +import com.azure.resourcemanager.security.models.SqlVulnerabilityAssessmentScanResults; +import com.azure.resourcemanager.security.models.SqlVulnerabilityAssessmentScans; +import com.azure.resourcemanager.security.models.SubAssessments; +import com.azure.resourcemanager.security.models.Tasks; +import com.azure.resourcemanager.security.models.Topologies; +import com.azure.resourcemanager.security.models.WorkspaceSettings; +import java.time.Duration; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +/** Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) resource provider. */ +public final class SecurityManager { + private ComplianceResults complianceResults; + + private Pricings pricings; + + private AdvancedThreatProtections advancedThreatProtections; + + private DeviceSecurityGroups deviceSecurityGroups; + + private IotSecuritySolutions iotSecuritySolutions; + + private IotSecuritySolutionAnalytics iotSecuritySolutionAnalytics; + + private IotSecuritySolutionsAnalyticsAggregatedAlerts iotSecuritySolutionsAnalyticsAggregatedAlerts; + + private IotSecuritySolutionsAnalyticsRecommendations iotSecuritySolutionsAnalyticsRecommendations; + + private Locations locations; + + private Operations operations; + + private Tasks tasks; + + private AutoProvisioningSettings autoProvisioningSettings; + + private Compliances compliances; + + private InformationProtectionPolicies informationProtectionPolicies; + + private SecurityContacts securityContacts; + + private WorkspaceSettings workspaceSettings; + + private RegulatoryComplianceStandards regulatoryComplianceStandards; + + private RegulatoryComplianceControls regulatoryComplianceControls; + + private RegulatoryComplianceAssessments regulatoryComplianceAssessments; + + private SubAssessments subAssessments; + + private Automations automations; + + private AlertsSuppressionRules alertsSuppressionRules; + + private ServerVulnerabilityAssessments serverVulnerabilityAssessments; + + private AssessmentsMetadatas assessmentsMetadatas; + + private Assessments assessments; + + private AdaptiveApplicationControls adaptiveApplicationControls; + + private AdaptiveNetworkHardenings adaptiveNetworkHardenings; + + private AllowedConnections allowedConnections; + + private Topologies topologies; + + private JitNetworkAccessPolicies jitNetworkAccessPolicies; + + private DiscoveredSecuritySolutions discoveredSecuritySolutions; + + private SecuritySolutionsReferenceDatas securitySolutionsReferenceDatas; + + private ExternalSecuritySolutions externalSecuritySolutions; + + private SecureScores secureScores; + + private SecureScoreControls secureScoreControls; + + private SecureScoreControlDefinitions secureScoreControlDefinitions; + + private SecuritySolutions securitySolutions; + + private Connectors connectors; + + private SqlVulnerabilityAssessmentScans sqlVulnerabilityAssessmentScans; + + private SqlVulnerabilityAssessmentScanResults sqlVulnerabilityAssessmentScanResults; + + private SqlVulnerabilityAssessmentBaselineRules sqlVulnerabilityAssessmentBaselineRules; + + private IotDefenderSettings iotDefenderSettings; + + private IotSensors iotSensors; + + private DevicesForSubscriptions devicesForSubscriptions; + + private DevicesForHubs devicesForHubs; + + private Devices devices; + + private OnPremiseIotSensors onPremiseIotSensors; + + private IotSites iotSites; + + private IotAlerts iotAlerts; + + private IotAlertTypes iotAlertTypes; + + private IotRecommendations iotRecommendations; + + private IotRecommendationTypes iotRecommendationTypes; + + private Alerts alerts; + + private Settings settings; + + private IngestionSettings ingestionSettings; + + private SoftwareInventories softwareInventories; + + private final SecurityCenter clientObject; + + private SecurityManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = + new SecurityCenterBuilder() + .pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of Security service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Security service API instance. + */ + public static SecurityManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return configure().authenticate(credential, profile); + } + + /** + * Gets a Configurable instance that can be used to create SecurityManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new SecurityManager.Configurable(); + } + + /** The Configurable allowing configurations to be set. */ + public static final class Configurable { + private final ClientLogger logger = new ClientLogger(Configurable.class); + + private HttpClient httpClient; + private HttpLogOptions httpLogOptions; + private final List policies = new ArrayList<>(); + private final List scopes = new ArrayList<>(); + private RetryPolicy retryPolicy; + private Duration defaultPollInterval; + + private Configurable() { + } + + /** + * Sets the http client. + * + * @param httpClient the HTTP client. + * @return the configurable object itself. + */ + public Configurable withHttpClient(HttpClient httpClient) { + this.httpClient = Objects.requireNonNull(httpClient, "'httpClient' cannot be null."); + return this; + } + + /** + * Sets the logging options to the HTTP pipeline. + * + * @param httpLogOptions the HTTP log options. + * @return the configurable object itself. + */ + public Configurable withLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = Objects.requireNonNull(httpLogOptions, "'httpLogOptions' cannot be null."); + return this; + } + + /** + * Adds the pipeline policy to the HTTP pipeline. + * + * @param policy the HTTP pipeline policy. + * @return the configurable object itself. + */ + public Configurable withPolicy(HttpPipelinePolicy policy) { + this.policies.add(Objects.requireNonNull(policy, "'policy' cannot be null.")); + return this; + } + + /** + * Adds the scope to permission sets. + * + * @param scope the scope. + * @return the configurable object itself. + */ + public Configurable withScope(String scope) { + this.scopes.add(Objects.requireNonNull(scope, "'scope' cannot be null.")); + return this; + } + + /** + * Sets the retry policy to the HTTP pipeline. + * + * @param retryPolicy the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = Objects.requireNonNull(retryPolicy, "'retryPolicy' cannot be null."); + return this; + } + + /** + * Sets the default poll interval, used when service does not provide "Retry-After" header. + * + * @param defaultPollInterval the default poll interval. + * @return the configurable object itself. + */ + public Configurable withDefaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = Objects.requireNonNull(defaultPollInterval, "'retryPolicy' cannot be null."); + if (this.defaultPollInterval.isNegative()) { + throw logger.logExceptionAsError(new IllegalArgumentException("'httpPipeline' cannot be negative")); + } + return this; + } + + /** + * Creates an instance of Security service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Security service API instance. + */ + public SecurityManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + + StringBuilder userAgentBuilder = new StringBuilder(); + userAgentBuilder + .append("azsdk-java") + .append("-") + .append("com.azure.resourcemanager.security") + .append("/") + .append("1.0.0-beta.1"); + if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { + userAgentBuilder + .append(" (") + .append(Configuration.getGlobalConfiguration().get("java.version")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.name")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.version")) + .append("; auto-generated)"); + } else { + userAgentBuilder.append(" (auto-generated)"); + } + + if (scopes.isEmpty()) { + scopes.add(profile.getEnvironment().getManagementEndpoint() + "/.default"); + } + if (retryPolicy == null) { + retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + } + List policies = new ArrayList<>(); + policies.add(new UserAgentPolicy(userAgentBuilder.toString())); + policies.add(new RequestIdPolicy()); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(retryPolicy); + policies.add(new AddDatePolicy()); + policies.add(new ArmChallengeAuthenticationPolicy(credential, scopes.toArray(new String[0]))); + policies.addAll(this.policies); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(httpLogOptions)); + HttpPipeline httpPipeline = + new HttpPipelineBuilder() + .httpClient(httpClient) + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .build(); + return new SecurityManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** @return Resource collection API of ComplianceResults. */ + public ComplianceResults complianceResults() { + if (this.complianceResults == null) { + this.complianceResults = new ComplianceResultsImpl(clientObject.getComplianceResults(), this); + } + return complianceResults; + } + + /** @return Resource collection API of Pricings. */ + public Pricings pricings() { + if (this.pricings == null) { + this.pricings = new PricingsImpl(clientObject.getPricings(), this); + } + return pricings; + } + + /** @return Resource collection API of AdvancedThreatProtections. */ + public AdvancedThreatProtections advancedThreatProtections() { + if (this.advancedThreatProtections == null) { + this.advancedThreatProtections = + new AdvancedThreatProtectionsImpl(clientObject.getAdvancedThreatProtections(), this); + } + return advancedThreatProtections; + } + + /** @return Resource collection API of DeviceSecurityGroups. */ + public DeviceSecurityGroups deviceSecurityGroups() { + if (this.deviceSecurityGroups == null) { + this.deviceSecurityGroups = new DeviceSecurityGroupsImpl(clientObject.getDeviceSecurityGroups(), this); + } + return deviceSecurityGroups; + } + + /** @return Resource collection API of IotSecuritySolutions. */ + public IotSecuritySolutions iotSecuritySolutions() { + if (this.iotSecuritySolutions == null) { + this.iotSecuritySolutions = new IotSecuritySolutionsImpl(clientObject.getIotSecuritySolutions(), this); + } + return iotSecuritySolutions; + } + + /** @return Resource collection API of IotSecuritySolutionAnalytics. */ + public IotSecuritySolutionAnalytics iotSecuritySolutionAnalytics() { + if (this.iotSecuritySolutionAnalytics == null) { + this.iotSecuritySolutionAnalytics = + new IotSecuritySolutionAnalyticsImpl(clientObject.getIotSecuritySolutionAnalytics(), this); + } + return iotSecuritySolutionAnalytics; + } + + /** @return Resource collection API of IotSecuritySolutionsAnalyticsAggregatedAlerts. */ + public IotSecuritySolutionsAnalyticsAggregatedAlerts iotSecuritySolutionsAnalyticsAggregatedAlerts() { + if (this.iotSecuritySolutionsAnalyticsAggregatedAlerts == null) { + this.iotSecuritySolutionsAnalyticsAggregatedAlerts = + new IotSecuritySolutionsAnalyticsAggregatedAlertsImpl( + clientObject.getIotSecuritySolutionsAnalyticsAggregatedAlerts(), this); + } + return iotSecuritySolutionsAnalyticsAggregatedAlerts; + } + + /** @return Resource collection API of IotSecuritySolutionsAnalyticsRecommendations. */ + public IotSecuritySolutionsAnalyticsRecommendations iotSecuritySolutionsAnalyticsRecommendations() { + if (this.iotSecuritySolutionsAnalyticsRecommendations == null) { + this.iotSecuritySolutionsAnalyticsRecommendations = + new IotSecuritySolutionsAnalyticsRecommendationsImpl( + clientObject.getIotSecuritySolutionsAnalyticsRecommendations(), this); + } + return iotSecuritySolutionsAnalyticsRecommendations; + } + + /** @return Resource collection API of Locations. */ + public Locations locations() { + if (this.locations == null) { + this.locations = new LocationsImpl(clientObject.getLocations(), this); + } + return locations; + } + + /** @return Resource collection API of Operations. */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(clientObject.getOperations(), this); + } + return operations; + } + + /** @return Resource collection API of Tasks. */ + public Tasks tasks() { + if (this.tasks == null) { + this.tasks = new TasksImpl(clientObject.getTasks(), this); + } + return tasks; + } + + /** @return Resource collection API of AutoProvisioningSettings. */ + public AutoProvisioningSettings autoProvisioningSettings() { + if (this.autoProvisioningSettings == null) { + this.autoProvisioningSettings = + new AutoProvisioningSettingsImpl(clientObject.getAutoProvisioningSettings(), this); + } + return autoProvisioningSettings; + } + + /** @return Resource collection API of Compliances. */ + public Compliances compliances() { + if (this.compliances == null) { + this.compliances = new CompliancesImpl(clientObject.getCompliances(), this); + } + return compliances; + } + + /** @return Resource collection API of InformationProtectionPolicies. */ + public InformationProtectionPolicies informationProtectionPolicies() { + if (this.informationProtectionPolicies == null) { + this.informationProtectionPolicies = + new InformationProtectionPoliciesImpl(clientObject.getInformationProtectionPolicies(), this); + } + return informationProtectionPolicies; + } + + /** @return Resource collection API of SecurityContacts. */ + public SecurityContacts securityContacts() { + if (this.securityContacts == null) { + this.securityContacts = new SecurityContactsImpl(clientObject.getSecurityContacts(), this); + } + return securityContacts; + } + + /** @return Resource collection API of WorkspaceSettings. */ + public WorkspaceSettings workspaceSettings() { + if (this.workspaceSettings == null) { + this.workspaceSettings = new WorkspaceSettingsImpl(clientObject.getWorkspaceSettings(), this); + } + return workspaceSettings; + } + + /** @return Resource collection API of RegulatoryComplianceStandards. */ + public RegulatoryComplianceStandards regulatoryComplianceStandards() { + if (this.regulatoryComplianceStandards == null) { + this.regulatoryComplianceStandards = + new RegulatoryComplianceStandardsImpl(clientObject.getRegulatoryComplianceStandards(), this); + } + return regulatoryComplianceStandards; + } + + /** @return Resource collection API of RegulatoryComplianceControls. */ + public RegulatoryComplianceControls regulatoryComplianceControls() { + if (this.regulatoryComplianceControls == null) { + this.regulatoryComplianceControls = + new RegulatoryComplianceControlsImpl(clientObject.getRegulatoryComplianceControls(), this); + } + return regulatoryComplianceControls; + } + + /** @return Resource collection API of RegulatoryComplianceAssessments. */ + public RegulatoryComplianceAssessments regulatoryComplianceAssessments() { + if (this.regulatoryComplianceAssessments == null) { + this.regulatoryComplianceAssessments = + new RegulatoryComplianceAssessmentsImpl(clientObject.getRegulatoryComplianceAssessments(), this); + } + return regulatoryComplianceAssessments; + } + + /** @return Resource collection API of SubAssessments. */ + public SubAssessments subAssessments() { + if (this.subAssessments == null) { + this.subAssessments = new SubAssessmentsImpl(clientObject.getSubAssessments(), this); + } + return subAssessments; + } + + /** @return Resource collection API of Automations. */ + public Automations automations() { + if (this.automations == null) { + this.automations = new AutomationsImpl(clientObject.getAutomations(), this); + } + return automations; + } + + /** @return Resource collection API of AlertsSuppressionRules. */ + public AlertsSuppressionRules alertsSuppressionRules() { + if (this.alertsSuppressionRules == null) { + this.alertsSuppressionRules = + new AlertsSuppressionRulesImpl(clientObject.getAlertsSuppressionRules(), this); + } + return alertsSuppressionRules; + } + + /** @return Resource collection API of ServerVulnerabilityAssessments. */ + public ServerVulnerabilityAssessments serverVulnerabilityAssessments() { + if (this.serverVulnerabilityAssessments == null) { + this.serverVulnerabilityAssessments = + new ServerVulnerabilityAssessmentsImpl(clientObject.getServerVulnerabilityAssessments(), this); + } + return serverVulnerabilityAssessments; + } + + /** @return Resource collection API of AssessmentsMetadatas. */ + public AssessmentsMetadatas assessmentsMetadatas() { + if (this.assessmentsMetadatas == null) { + this.assessmentsMetadatas = new AssessmentsMetadatasImpl(clientObject.getAssessmentsMetadatas(), this); + } + return assessmentsMetadatas; + } + + /** @return Resource collection API of Assessments. */ + public Assessments assessments() { + if (this.assessments == null) { + this.assessments = new AssessmentsImpl(clientObject.getAssessments(), this); + } + return assessments; + } + + /** @return Resource collection API of AdaptiveApplicationControls. */ + public AdaptiveApplicationControls adaptiveApplicationControls() { + if (this.adaptiveApplicationControls == null) { + this.adaptiveApplicationControls = + new AdaptiveApplicationControlsImpl(clientObject.getAdaptiveApplicationControls(), this); + } + return adaptiveApplicationControls; + } + + /** @return Resource collection API of AdaptiveNetworkHardenings. */ + public AdaptiveNetworkHardenings adaptiveNetworkHardenings() { + if (this.adaptiveNetworkHardenings == null) { + this.adaptiveNetworkHardenings = + new AdaptiveNetworkHardeningsImpl(clientObject.getAdaptiveNetworkHardenings(), this); + } + return adaptiveNetworkHardenings; + } + + /** @return Resource collection API of AllowedConnections. */ + public AllowedConnections allowedConnections() { + if (this.allowedConnections == null) { + this.allowedConnections = new AllowedConnectionsImpl(clientObject.getAllowedConnections(), this); + } + return allowedConnections; + } + + /** @return Resource collection API of Topologies. */ + public Topologies topologies() { + if (this.topologies == null) { + this.topologies = new TopologiesImpl(clientObject.getTopologies(), this); + } + return topologies; + } + + /** @return Resource collection API of JitNetworkAccessPolicies. */ + public JitNetworkAccessPolicies jitNetworkAccessPolicies() { + if (this.jitNetworkAccessPolicies == null) { + this.jitNetworkAccessPolicies = + new JitNetworkAccessPoliciesImpl(clientObject.getJitNetworkAccessPolicies(), this); + } + return jitNetworkAccessPolicies; + } + + /** @return Resource collection API of DiscoveredSecuritySolutions. */ + public DiscoveredSecuritySolutions discoveredSecuritySolutions() { + if (this.discoveredSecuritySolutions == null) { + this.discoveredSecuritySolutions = + new DiscoveredSecuritySolutionsImpl(clientObject.getDiscoveredSecuritySolutions(), this); + } + return discoveredSecuritySolutions; + } + + /** @return Resource collection API of SecuritySolutionsReferenceDatas. */ + public SecuritySolutionsReferenceDatas securitySolutionsReferenceDatas() { + if (this.securitySolutionsReferenceDatas == null) { + this.securitySolutionsReferenceDatas = + new SecuritySolutionsReferenceDatasImpl(clientObject.getSecuritySolutionsReferenceDatas(), this); + } + return securitySolutionsReferenceDatas; + } + + /** @return Resource collection API of ExternalSecuritySolutions. */ + public ExternalSecuritySolutions externalSecuritySolutions() { + if (this.externalSecuritySolutions == null) { + this.externalSecuritySolutions = + new ExternalSecuritySolutionsImpl(clientObject.getExternalSecuritySolutions(), this); + } + return externalSecuritySolutions; + } + + /** @return Resource collection API of SecureScores. */ + public SecureScores secureScores() { + if (this.secureScores == null) { + this.secureScores = new SecureScoresImpl(clientObject.getSecureScores(), this); + } + return secureScores; + } + + /** @return Resource collection API of SecureScoreControls. */ + public SecureScoreControls secureScoreControls() { + if (this.secureScoreControls == null) { + this.secureScoreControls = new SecureScoreControlsImpl(clientObject.getSecureScoreControls(), this); + } + return secureScoreControls; + } + + /** @return Resource collection API of SecureScoreControlDefinitions. */ + public SecureScoreControlDefinitions secureScoreControlDefinitions() { + if (this.secureScoreControlDefinitions == null) { + this.secureScoreControlDefinitions = + new SecureScoreControlDefinitionsImpl(clientObject.getSecureScoreControlDefinitions(), this); + } + return secureScoreControlDefinitions; + } + + /** @return Resource collection API of SecuritySolutions. */ + public SecuritySolutions securitySolutions() { + if (this.securitySolutions == null) { + this.securitySolutions = new SecuritySolutionsImpl(clientObject.getSecuritySolutions(), this); + } + return securitySolutions; + } + + /** @return Resource collection API of Connectors. */ + public Connectors connectors() { + if (this.connectors == null) { + this.connectors = new ConnectorsImpl(clientObject.getConnectors(), this); + } + return connectors; + } + + /** @return Resource collection API of SqlVulnerabilityAssessmentScans. */ + public SqlVulnerabilityAssessmentScans sqlVulnerabilityAssessmentScans() { + if (this.sqlVulnerabilityAssessmentScans == null) { + this.sqlVulnerabilityAssessmentScans = + new SqlVulnerabilityAssessmentScansImpl(clientObject.getSqlVulnerabilityAssessmentScans(), this); + } + return sqlVulnerabilityAssessmentScans; + } + + /** @return Resource collection API of SqlVulnerabilityAssessmentScanResults. */ + public SqlVulnerabilityAssessmentScanResults sqlVulnerabilityAssessmentScanResults() { + if (this.sqlVulnerabilityAssessmentScanResults == null) { + this.sqlVulnerabilityAssessmentScanResults = + new SqlVulnerabilityAssessmentScanResultsImpl( + clientObject.getSqlVulnerabilityAssessmentScanResults(), this); + } + return sqlVulnerabilityAssessmentScanResults; + } + + /** @return Resource collection API of SqlVulnerabilityAssessmentBaselineRules. */ + public SqlVulnerabilityAssessmentBaselineRules sqlVulnerabilityAssessmentBaselineRules() { + if (this.sqlVulnerabilityAssessmentBaselineRules == null) { + this.sqlVulnerabilityAssessmentBaselineRules = + new SqlVulnerabilityAssessmentBaselineRulesImpl( + clientObject.getSqlVulnerabilityAssessmentBaselineRules(), this); + } + return sqlVulnerabilityAssessmentBaselineRules; + } + + /** @return Resource collection API of IotDefenderSettings. */ + public IotDefenderSettings iotDefenderSettings() { + if (this.iotDefenderSettings == null) { + this.iotDefenderSettings = new IotDefenderSettingsImpl(clientObject.getIotDefenderSettings(), this); + } + return iotDefenderSettings; + } + + /** @return Resource collection API of IotSensors. */ + public IotSensors iotSensors() { + if (this.iotSensors == null) { + this.iotSensors = new IotSensorsImpl(clientObject.getIotSensors(), this); + } + return iotSensors; + } + + /** @return Resource collection API of DevicesForSubscriptions. */ + public DevicesForSubscriptions devicesForSubscriptions() { + if (this.devicesForSubscriptions == null) { + this.devicesForSubscriptions = + new DevicesForSubscriptionsImpl(clientObject.getDevicesForSubscriptions(), this); + } + return devicesForSubscriptions; + } + + /** @return Resource collection API of DevicesForHubs. */ + public DevicesForHubs devicesForHubs() { + if (this.devicesForHubs == null) { + this.devicesForHubs = new DevicesForHubsImpl(clientObject.getDevicesForHubs(), this); + } + return devicesForHubs; + } + + /** @return Resource collection API of Devices. */ + public Devices devices() { + if (this.devices == null) { + this.devices = new DevicesImpl(clientObject.getDevices(), this); + } + return devices; + } + + /** @return Resource collection API of OnPremiseIotSensors. */ + public OnPremiseIotSensors onPremiseIotSensors() { + if (this.onPremiseIotSensors == null) { + this.onPremiseIotSensors = new OnPremiseIotSensorsImpl(clientObject.getOnPremiseIotSensors(), this); + } + return onPremiseIotSensors; + } + + /** @return Resource collection API of IotSites. */ + public IotSites iotSites() { + if (this.iotSites == null) { + this.iotSites = new IotSitesImpl(clientObject.getIotSites(), this); + } + return iotSites; + } + + /** @return Resource collection API of IotAlerts. */ + public IotAlerts iotAlerts() { + if (this.iotAlerts == null) { + this.iotAlerts = new IotAlertsImpl(clientObject.getIotAlerts(), this); + } + return iotAlerts; + } + + /** @return Resource collection API of IotAlertTypes. */ + public IotAlertTypes iotAlertTypes() { + if (this.iotAlertTypes == null) { + this.iotAlertTypes = new IotAlertTypesImpl(clientObject.getIotAlertTypes(), this); + } + return iotAlertTypes; + } + + /** @return Resource collection API of IotRecommendations. */ + public IotRecommendations iotRecommendations() { + if (this.iotRecommendations == null) { + this.iotRecommendations = new IotRecommendationsImpl(clientObject.getIotRecommendations(), this); + } + return iotRecommendations; + } + + /** @return Resource collection API of IotRecommendationTypes. */ + public IotRecommendationTypes iotRecommendationTypes() { + if (this.iotRecommendationTypes == null) { + this.iotRecommendationTypes = + new IotRecommendationTypesImpl(clientObject.getIotRecommendationTypes(), this); + } + return iotRecommendationTypes; + } + + /** @return Resource collection API of Alerts. */ + public Alerts alerts() { + if (this.alerts == null) { + this.alerts = new AlertsImpl(clientObject.getAlerts(), this); + } + return alerts; + } + + /** @return Resource collection API of Settings. */ + public Settings settings() { + if (this.settings == null) { + this.settings = new SettingsImpl(clientObject.getSettings(), this); + } + return settings; + } + + /** @return Resource collection API of IngestionSettings. */ + public IngestionSettings ingestionSettings() { + if (this.ingestionSettings == null) { + this.ingestionSettings = new IngestionSettingsImpl(clientObject.getIngestionSettings(), this); + } + return ingestionSettings; + } + + /** @return Resource collection API of SoftwareInventories. */ + public SoftwareInventories softwareInventories() { + if (this.softwareInventories == null) { + this.softwareInventories = new SoftwareInventoriesImpl(clientObject.getSoftwareInventories(), this); + } + return softwareInventories; + } + + /** + * @return Wrapped service client SecurityCenter providing direct access to the underlying auto-generated API + * implementation, based on Azure REST API. + */ + public SecurityCenter serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/AdaptiveApplicationControlsClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/AdaptiveApplicationControlsClient.java new file mode 100644 index 000000000000..0febf887693d --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/AdaptiveApplicationControlsClient.java @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.AdaptiveApplicationControlGroupInner; +import com.azure.resourcemanager.security.fluent.models.AdaptiveApplicationControlGroupsInner; + +/** An instance of this class provides access to all the operations defined in AdaptiveApplicationControlsClient. */ +public interface AdaptiveApplicationControlsClient { + /** + * Gets a list of application control machine groups for the subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of application control machine groups for the subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AdaptiveApplicationControlGroupsInner list(); + + /** + * Gets a list of application control machine groups for the subscription. + * + * @param includePathRecommendations Include the policy rules. + * @param summary Return output in a summarized form. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of application control machine groups for the subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listWithResponse( + Boolean includePathRecommendations, Boolean summary, Context context); + + /** + * Gets an application control VM/server group. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param groupName Name of an application control machine group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an application control VM/server group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AdaptiveApplicationControlGroupInner get(String ascLocation, String groupName); + + /** + * Gets an application control VM/server group. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param groupName Name of an application control machine group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an application control VM/server group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String ascLocation, String groupName, Context context); + + /** + * Update an application control machine group. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param groupName Name of an application control machine group. + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AdaptiveApplicationControlGroupInner put( + String ascLocation, String groupName, AdaptiveApplicationControlGroupInner body); + + /** + * Update an application control machine group. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param groupName Name of an application control machine group. + * @param body The body parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response putWithResponse( + String ascLocation, String groupName, AdaptiveApplicationControlGroupInner body, Context context); + + /** + * Delete an application control machine group. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param groupName Name of an application control machine group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String ascLocation, String groupName); + + /** + * Delete an application control machine group. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param groupName Name of an application control machine group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String ascLocation, String groupName, Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/AdaptiveNetworkHardeningsClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/AdaptiveNetworkHardeningsClient.java new file mode 100644 index 000000000000..da45ed63794d --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/AdaptiveNetworkHardeningsClient.java @@ -0,0 +1,197 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.security.fluent.models.AdaptiveNetworkHardeningInner; +import com.azure.resourcemanager.security.models.AdaptiveNetworkHardeningEnforceRequest; + +/** An instance of this class provides access to all the operations defined in AdaptiveNetworkHardeningsClient. */ +public interface AdaptiveNetworkHardeningsClient { + /** + * Gets a list of Adaptive Network Hardenings resources in scope of an extended resource. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Adaptive Network Hardenings resources in scope of an extended resource. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByExtendedResource( + String resourceGroupName, String resourceNamespace, String resourceType, String resourceName); + + /** + * Gets a list of Adaptive Network Hardenings resources in scope of an extended resource. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Adaptive Network Hardenings resources in scope of an extended resource. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByExtendedResource( + String resourceGroupName, String resourceNamespace, String resourceType, String resourceName, Context context); + + /** + * Gets a single Adaptive Network Hardening resource. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @param adaptiveNetworkHardeningResourceName The name of the Adaptive Network Hardening resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a single Adaptive Network Hardening resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AdaptiveNetworkHardeningInner get( + String resourceGroupName, + String resourceNamespace, + String resourceType, + String resourceName, + String adaptiveNetworkHardeningResourceName); + + /** + * Gets a single Adaptive Network Hardening resource. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @param adaptiveNetworkHardeningResourceName The name of the Adaptive Network Hardening resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a single Adaptive Network Hardening resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String resourceNamespace, + String resourceType, + String resourceName, + String adaptiveNetworkHardeningResourceName, + Context context); + + /** + * Enforces the given rules on the NSG(s) listed in the request. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @param adaptiveNetworkHardeningResourceName The name of the Adaptive Network Hardening resource. + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginEnforce( + String resourceGroupName, + String resourceNamespace, + String resourceType, + String resourceName, + String adaptiveNetworkHardeningResourceName, + AdaptiveNetworkHardeningEnforceRequest body); + + /** + * Enforces the given rules on the NSG(s) listed in the request. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @param adaptiveNetworkHardeningResourceName The name of the Adaptive Network Hardening resource. + * @param body The body parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginEnforce( + String resourceGroupName, + String resourceNamespace, + String resourceType, + String resourceName, + String adaptiveNetworkHardeningResourceName, + AdaptiveNetworkHardeningEnforceRequest body, + Context context); + + /** + * Enforces the given rules on the NSG(s) listed in the request. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @param adaptiveNetworkHardeningResourceName The name of the Adaptive Network Hardening resource. + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void enforce( + String resourceGroupName, + String resourceNamespace, + String resourceType, + String resourceName, + String adaptiveNetworkHardeningResourceName, + AdaptiveNetworkHardeningEnforceRequest body); + + /** + * Enforces the given rules on the NSG(s) listed in the request. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @param adaptiveNetworkHardeningResourceName The name of the Adaptive Network Hardening resource. + * @param body The body parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void enforce( + String resourceGroupName, + String resourceNamespace, + String resourceType, + String resourceName, + String adaptiveNetworkHardeningResourceName, + AdaptiveNetworkHardeningEnforceRequest body, + Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/AdvancedThreatProtectionsClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/AdvancedThreatProtectionsClient.java new file mode 100644 index 000000000000..ed227389460f --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/AdvancedThreatProtectionsClient.java @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.AdvancedThreatProtectionSettingInner; + +/** An instance of this class provides access to all the operations defined in AdvancedThreatProtectionsClient. */ +public interface AdvancedThreatProtectionsClient { + /** + * Gets the Advanced Threat Protection settings for the specified resource. + * + * @param resourceId The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Advanced Threat Protection settings for the specified resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AdvancedThreatProtectionSettingInner get(String resourceId); + + /** + * Gets the Advanced Threat Protection settings for the specified resource. + * + * @param resourceId The identifier of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Advanced Threat Protection settings for the specified resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceId, Context context); + + /** + * Creates or updates the Advanced Threat Protection settings on a specified resource. + * + * @param resourceId The identifier of the resource. + * @param advancedThreatProtectionSetting Advanced Threat Protection Settings. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Advanced Threat Protection resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AdvancedThreatProtectionSettingInner create( + String resourceId, AdvancedThreatProtectionSettingInner advancedThreatProtectionSetting); + + /** + * Creates or updates the Advanced Threat Protection settings on a specified resource. + * + * @param resourceId The identifier of the resource. + * @param advancedThreatProtectionSetting Advanced Threat Protection Settings. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Advanced Threat Protection resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createWithResponse( + String resourceId, AdvancedThreatProtectionSettingInner advancedThreatProtectionSetting, Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/AlertsClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/AlertsClient.java new file mode 100644 index 000000000000..a2e489ff8652 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/AlertsClient.java @@ -0,0 +1,433 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.security.fluent.models.AlertInner; +import com.azure.resourcemanager.security.models.AlertSimulatorRequestBody; + +/** An instance of this class provides access to all the operations defined in AlertsClient. */ +public interface AlertsClient { + /** + * List all the alerts that are associated with the subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security alerts. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List all the alerts that are associated with the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security alerts. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * List all the alerts that are associated with the resource group. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security alerts. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List all the alerts that are associated with the resource group. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security alerts. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * List all the alerts that are associated with the subscription that are stored in a specific location. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security alerts. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listSubscriptionLevelByRegion(String ascLocation); + + /** + * List all the alerts that are associated with the subscription that are stored in a specific location. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security alerts. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listSubscriptionLevelByRegion(String ascLocation, Context context); + + /** + * List all the alerts that are associated with the resource group that are stored in a specific location. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security alerts. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listResourceGroupLevelByRegion(String ascLocation, String resourceGroupName); + + /** + * List all the alerts that are associated with the resource group that are stored in a specific location. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security alerts. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listResourceGroupLevelByRegion( + String ascLocation, String resourceGroupName, Context context); + + /** + * Get an alert that is associated with a subscription. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param alertName Name of the alert object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an alert that is associated with a subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AlertInner getSubscriptionLevel(String ascLocation, String alertName); + + /** + * Get an alert that is associated with a subscription. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param alertName Name of the alert object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an alert that is associated with a subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getSubscriptionLevelWithResponse(String ascLocation, String alertName, Context context); + + /** + * Get an alert that is associated a resource group or a resource in a resource group. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param alertName Name of the alert object. + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an alert that is associated a resource group or a resource in a resource group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AlertInner getResourceGroupLevel(String ascLocation, String alertName, String resourceGroupName); + + /** + * Get an alert that is associated a resource group or a resource in a resource group. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param alertName Name of the alert object. + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an alert that is associated a resource group or a resource in a resource group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getResourceGroupLevelWithResponse( + String ascLocation, String alertName, String resourceGroupName, Context context); + + /** + * Update the alert's state. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param alertName Name of the alert object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void updateSubscriptionLevelStateToDismiss(String ascLocation, String alertName); + + /** + * Update the alert's state. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param alertName Name of the alert object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateSubscriptionLevelStateToDismissWithResponse( + String ascLocation, String alertName, Context context); + + /** + * Update the alert's state. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param alertName Name of the alert object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void updateSubscriptionLevelStateToResolve(String ascLocation, String alertName); + + /** + * Update the alert's state. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param alertName Name of the alert object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateSubscriptionLevelStateToResolveWithResponse( + String ascLocation, String alertName, Context context); + + /** + * Update the alert's state. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param alertName Name of the alert object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void updateSubscriptionLevelStateToActivate(String ascLocation, String alertName); + + /** + * Update the alert's state. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param alertName Name of the alert object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateSubscriptionLevelStateToActivateWithResponse( + String ascLocation, String alertName, Context context); + + /** + * Update the alert's state. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param alertName Name of the alert object. + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void updateResourceGroupLevelStateToResolve(String ascLocation, String alertName, String resourceGroupName); + + /** + * Update the alert's state. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param alertName Name of the alert object. + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateResourceGroupLevelStateToResolveWithResponse( + String ascLocation, String alertName, String resourceGroupName, Context context); + + /** + * Update the alert's state. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param alertName Name of the alert object. + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void updateResourceGroupLevelStateToDismiss(String ascLocation, String alertName, String resourceGroupName); + + /** + * Update the alert's state. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param alertName Name of the alert object. + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateResourceGroupLevelStateToDismissWithResponse( + String ascLocation, String alertName, String resourceGroupName, Context context); + + /** + * Update the alert's state. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param alertName Name of the alert object. + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void updateResourceGroupLevelStateToActivate(String ascLocation, String alertName, String resourceGroupName); + + /** + * Update the alert's state. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param alertName Name of the alert object. + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateResourceGroupLevelStateToActivateWithResponse( + String ascLocation, String alertName, String resourceGroupName, Context context); + + /** + * Simulate security alerts. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param alertSimulatorRequestBody Alert Simulator Request Properties. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginSimulate( + String ascLocation, AlertSimulatorRequestBody alertSimulatorRequestBody); + + /** + * Simulate security alerts. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param alertSimulatorRequestBody Alert Simulator Request Properties. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginSimulate( + String ascLocation, AlertSimulatorRequestBody alertSimulatorRequestBody, Context context); + + /** + * Simulate security alerts. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param alertSimulatorRequestBody Alert Simulator Request Properties. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void simulate(String ascLocation, AlertSimulatorRequestBody alertSimulatorRequestBody); + + /** + * Simulate security alerts. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param alertSimulatorRequestBody Alert Simulator Request Properties. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void simulate(String ascLocation, AlertSimulatorRequestBody alertSimulatorRequestBody, Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/AlertsSuppressionRulesClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/AlertsSuppressionRulesClient.java new file mode 100644 index 000000000000..56bfb72b4229 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/AlertsSuppressionRulesClient.java @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.AlertsSuppressionRuleInner; + +/** An instance of this class provides access to all the operations defined in AlertsSuppressionRulesClient. */ +public interface AlertsSuppressionRulesClient { + /** + * List of all the dismiss rules for the given subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return suppression rules list for subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List of all the dismiss rules for the given subscription. + * + * @param alertType Type of the alert to get rules for. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return suppression rules list for subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String alertType, Context context); + + /** + * Get dismiss rule, with name: {alertsSuppressionRuleName}, for the given subscription. + * + * @param alertsSuppressionRuleName The unique name of the suppression alert rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return dismiss rule, with name: {alertsSuppressionRuleName}, for the given subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AlertsSuppressionRuleInner get(String alertsSuppressionRuleName); + + /** + * Get dismiss rule, with name: {alertsSuppressionRuleName}, for the given subscription. + * + * @param alertsSuppressionRuleName The unique name of the suppression alert rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return dismiss rule, with name: {alertsSuppressionRuleName}, for the given subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String alertsSuppressionRuleName, Context context); + + /** + * Update existing rule or create new rule if it doesn't exist. + * + * @param alertsSuppressionRuleName The unique name of the suppression alert rule. + * @param alertsSuppressionRule Suppression rule object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the suppression rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AlertsSuppressionRuleInner update( + String alertsSuppressionRuleName, AlertsSuppressionRuleInner alertsSuppressionRule); + + /** + * Update existing rule or create new rule if it doesn't exist. + * + * @param alertsSuppressionRuleName The unique name of the suppression alert rule. + * @param alertsSuppressionRule Suppression rule object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the suppression rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String alertsSuppressionRuleName, AlertsSuppressionRuleInner alertsSuppressionRule, Context context); + + /** + * Delete dismiss alert rule for this subscription. + * + * @param alertsSuppressionRuleName The unique name of the suppression alert rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String alertsSuppressionRuleName); + + /** + * Delete dismiss alert rule for this subscription. + * + * @param alertsSuppressionRuleName The unique name of the suppression alert rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String alertsSuppressionRuleName, Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/AllowedConnectionsClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/AllowedConnectionsClient.java new file mode 100644 index 000000000000..1597043d4c4d --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/AllowedConnectionsClient.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.AllowedConnectionsResourceInner; +import com.azure.resourcemanager.security.models.ConnectionType; + +/** An instance of this class provides access to all the operations defined in AllowedConnectionsClient. */ +public interface AllowedConnectionsClient { + /** + * Gets the list of all possible traffic between resources for the subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of all possible traffic between resources for the subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Gets the list of all possible traffic between resources for the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of all possible traffic between resources for the subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * Gets the list of all possible traffic between resources for the subscription and location. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of all possible traffic between resources for the subscription and location. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByHomeRegion(String ascLocation); + + /** + * Gets the list of all possible traffic between resources for the subscription and location. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of all possible traffic between resources for the subscription and location. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByHomeRegion(String ascLocation, Context context); + + /** + * Gets the list of all possible traffic between resources for the subscription and location, based on connection + * type. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param connectionType The type of allowed connections (Internal, External). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of all possible traffic between resources for the subscription and location, based on connection + * type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AllowedConnectionsResourceInner get(String resourceGroupName, String ascLocation, ConnectionType connectionType); + + /** + * Gets the list of all possible traffic between resources for the subscription and location, based on connection + * type. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param connectionType The type of allowed connections (Internal, External). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of all possible traffic between resources for the subscription and location, based on connection + * type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String ascLocation, ConnectionType connectionType, Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/AssessmentsClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/AssessmentsClient.java new file mode 100644 index 000000000000..5d3b6586bae3 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/AssessmentsClient.java @@ -0,0 +1,133 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.SecurityAssessmentInner; +import com.azure.resourcemanager.security.models.ExpandEnum; + +/** An instance of this class provides access to all the operations defined in AssessmentsClient. */ +public interface AssessmentsClient { + /** + * Get security assessments on all your scanned resources inside a scope. + * + * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return security assessments on all your scanned resources inside a scope. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String scope); + + /** + * Get security assessments on all your scanned resources inside a scope. + * + * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return security assessments on all your scanned resources inside a scope. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String scope, Context context); + + /** + * Get a security assessment on your scanned resource. + * + * @param resourceId The identifier of the resource. + * @param assessmentName The Assessment Key - Unique key for the assessment type. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a security assessment on your scanned resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SecurityAssessmentInner get(String resourceId, String assessmentName); + + /** + * Get a security assessment on your scanned resource. + * + * @param resourceId The identifier of the resource. + * @param assessmentName The Assessment Key - Unique key for the assessment type. + * @param expand OData expand. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a security assessment on your scanned resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceId, String assessmentName, ExpandEnum expand, Context context); + + /** + * Create a security assessment on your resource. An assessment metadata that describes this assessment must be + * predefined with the same name before inserting the assessment result. + * + * @param resourceId The identifier of the resource. + * @param assessmentName The Assessment Key - Unique key for the assessment type. + * @param assessment Calculated assessment on a pre-defined assessment metadata. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return security assessment on a resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SecurityAssessmentInner createOrUpdate( + String resourceId, String assessmentName, SecurityAssessmentInner assessment); + + /** + * Create a security assessment on your resource. An assessment metadata that describes this assessment must be + * predefined with the same name before inserting the assessment result. + * + * @param resourceId The identifier of the resource. + * @param assessmentName The Assessment Key - Unique key for the assessment type. + * @param assessment Calculated assessment on a pre-defined assessment metadata. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return security assessment on a resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceId, String assessmentName, SecurityAssessmentInner assessment, Context context); + + /** + * Delete a security assessment on your resource. An assessment metadata that describes this assessment must be + * predefined with the same name before inserting the assessment result. + * + * @param resourceId The identifier of the resource. + * @param assessmentName The Assessment Key - Unique key for the assessment type. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceId, String assessmentName); + + /** + * Delete a security assessment on your resource. An assessment metadata that describes this assessment must be + * predefined with the same name before inserting the assessment result. + * + * @param resourceId The identifier of the resource. + * @param assessmentName The Assessment Key - Unique key for the assessment type. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String resourceId, String assessmentName, Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/AssessmentsMetadatasClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/AssessmentsMetadatasClient.java new file mode 100644 index 000000000000..6cc6f62ecf44 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/AssessmentsMetadatasClient.java @@ -0,0 +1,165 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.SecurityAssessmentMetadataInner; + +/** An instance of this class provides access to all the operations defined in AssessmentsMetadatasClient. */ +public interface AssessmentsMetadatasClient { + /** + * Get metadata information on all assessment types. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return metadata information on all assessment types. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Get metadata information on all assessment types. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return metadata information on all assessment types. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * Get metadata information on an assessment type. + * + * @param assessmentMetadataName The Assessment Key - Unique key for the assessment type. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return metadata information on an assessment type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SecurityAssessmentMetadataInner get(String assessmentMetadataName); + + /** + * Get metadata information on an assessment type. + * + * @param assessmentMetadataName The Assessment Key - Unique key for the assessment type. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return metadata information on an assessment type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String assessmentMetadataName, Context context); + + /** + * Get metadata information on all assessment types in a specific subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return metadata information on all assessment types in a specific subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listBySubscription(); + + /** + * Get metadata information on all assessment types in a specific subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return metadata information on all assessment types in a specific subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listBySubscription(Context context); + + /** + * Get metadata information on an assessment type in a specific subscription. + * + * @param assessmentMetadataName The Assessment Key - Unique key for the assessment type. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return metadata information on an assessment type in a specific subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SecurityAssessmentMetadataInner getInSubscription(String assessmentMetadataName); + + /** + * Get metadata information on an assessment type in a specific subscription. + * + * @param assessmentMetadataName The Assessment Key - Unique key for the assessment type. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return metadata information on an assessment type in a specific subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getInSubscriptionWithResponse( + String assessmentMetadataName, Context context); + + /** + * Create metadata information on an assessment type in a specific subscription. + * + * @param assessmentMetadataName The Assessment Key - Unique key for the assessment type. + * @param assessmentMetadata AssessmentMetadata object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return security assessment metadata. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SecurityAssessmentMetadataInner createInSubscription( + String assessmentMetadataName, SecurityAssessmentMetadataInner assessmentMetadata); + + /** + * Create metadata information on an assessment type in a specific subscription. + * + * @param assessmentMetadataName The Assessment Key - Unique key for the assessment type. + * @param assessmentMetadata AssessmentMetadata object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return security assessment metadata. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createInSubscriptionWithResponse( + String assessmentMetadataName, SecurityAssessmentMetadataInner assessmentMetadata, Context context); + + /** + * Delete metadata information on an assessment type in a specific subscription, will cause the deletion of all the + * assessments of that type in that subscription. + * + * @param assessmentMetadataName The Assessment Key - Unique key for the assessment type. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void deleteInSubscription(String assessmentMetadataName); + + /** + * Delete metadata information on an assessment type in a specific subscription, will cause the deletion of all the + * assessments of that type in that subscription. + * + * @param assessmentMetadataName The Assessment Key - Unique key for the assessment type. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteInSubscriptionWithResponse(String assessmentMetadataName, Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/AutoProvisioningSettingsClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/AutoProvisioningSettingsClient.java new file mode 100644 index 000000000000..85f54c8b527f --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/AutoProvisioningSettingsClient.java @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.AutoProvisioningSettingInner; + +/** An instance of this class provides access to all the operations defined in AutoProvisioningSettingsClient. */ +public interface AutoProvisioningSettingsClient { + /** + * Exposes the auto provisioning settings of the subscriptions. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of all the auto provisioning settings response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Exposes the auto provisioning settings of the subscriptions. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of all the auto provisioning settings response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * Details of a specific setting. + * + * @param settingName Auto provisioning setting key. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return auto provisioning setting. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AutoProvisioningSettingInner get(String settingName); + + /** + * Details of a specific setting. + * + * @param settingName Auto provisioning setting key. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return auto provisioning setting. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String settingName, Context context); + + /** + * Details of a specific setting. + * + * @param settingName Auto provisioning setting key. + * @param setting Auto provisioning setting key. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return auto provisioning setting. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AutoProvisioningSettingInner create(String settingName, AutoProvisioningSettingInner setting); + + /** + * Details of a specific setting. + * + * @param settingName Auto provisioning setting key. + * @param setting Auto provisioning setting key. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return auto provisioning setting. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createWithResponse( + String settingName, AutoProvisioningSettingInner setting, Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/AutomationsClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/AutomationsClient.java new file mode 100644 index 000000000000..0a35d74e3790 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/AutomationsClient.java @@ -0,0 +1,196 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.AutomationInner; +import com.azure.resourcemanager.security.fluent.models.AutomationValidationStatusInner; + +/** An instance of this class provides access to all the operations defined in AutomationsClient. */ +public interface AutomationsClient { + /** + * Lists all the security automations in the specified subscription. Use the 'nextLink' property in the response to + * get the next page of security automations for the specified subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security automations response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Lists all the security automations in the specified subscription. Use the 'nextLink' property in the response to + * get the next page of security automations for the specified subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security automations response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * Lists all the security automations in the specified resource group. Use the 'nextLink' property in the response + * to get the next page of security automations for the specified resource group. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security automations response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Lists all the security automations in the specified resource group. Use the 'nextLink' property in the response + * to get the next page of security automations for the specified resource group. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security automations response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Retrieves information about the model of a security automation. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param automationName The security automation name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the security automation resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AutomationInner getByResourceGroup(String resourceGroupName, String automationName); + + /** + * Retrieves information about the model of a security automation. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param automationName The security automation name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the security automation resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String automationName, Context context); + + /** + * Creates or updates a security automation. If a security automation is already created and a subsequent request is + * issued for the same automation id, then it will be updated. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param automationName The security automation name. + * @param automation The security automation resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the security automation resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AutomationInner createOrUpdate(String resourceGroupName, String automationName, AutomationInner automation); + + /** + * Creates or updates a security automation. If a security automation is already created and a subsequent request is + * issued for the same automation id, then it will be updated. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param automationName The security automation name. + * @param automation The security automation resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the security automation resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, String automationName, AutomationInner automation, Context context); + + /** + * Deletes a security automation. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param automationName The security automation name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String automationName); + + /** + * Deletes a security automation. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param automationName The security automation name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String resourceGroupName, String automationName, Context context); + + /** + * Validates the security automation model before create or update. Any validation errors are returned to the + * client. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param automationName The security automation name. + * @param automation The security automation resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the security automation model state property bag. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AutomationValidationStatusInner validate( + String resourceGroupName, String automationName, AutomationInner automation); + + /** + * Validates the security automation model before create or update. Any validation errors are returned to the + * client. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param automationName The security automation name. + * @param automation The security automation resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the security automation model state property bag. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response validateWithResponse( + String resourceGroupName, String automationName, AutomationInner automation, Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/ComplianceResultsClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/ComplianceResultsClient.java new file mode 100644 index 000000000000..e0f03ed56e65 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/ComplianceResultsClient.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.ComplianceResultInner; + +/** An instance of this class provides access to all the operations defined in ComplianceResultsClient. */ +public interface ComplianceResultsClient { + /** + * Security compliance results in the subscription. + * + * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of compliance results response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String scope); + + /** + * Security compliance results in the subscription. + * + * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of compliance results response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String scope, Context context); + + /** + * Security Compliance Result. + * + * @param resourceId The identifier of the resource. + * @param complianceResultName name of the desired assessment compliance result. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a compliance result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ComplianceResultInner get(String resourceId, String complianceResultName); + + /** + * Security Compliance Result. + * + * @param resourceId The identifier of the resource. + * @param complianceResultName name of the desired assessment compliance result. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a compliance result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceId, String complianceResultName, Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/CompliancesClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/CompliancesClient.java new file mode 100644 index 000000000000..368db296b9de --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/CompliancesClient.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.ComplianceInner; + +/** An instance of this class provides access to all the operations defined in CompliancesClient. */ +public interface CompliancesClient { + /** + * The Compliance scores of the specific management group. + * + * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Compliance objects response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String scope); + + /** + * The Compliance scores of the specific management group. + * + * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Compliance objects response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String scope, Context context); + + /** + * Details of a specific Compliance. + * + * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @param complianceName name of the Compliance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return compliance of a scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ComplianceInner get(String scope, String complianceName); + + /** + * Details of a specific Compliance. + * + * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @param complianceName name of the Compliance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return compliance of a scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String scope, String complianceName, Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/ConnectorsClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/ConnectorsClient.java new file mode 100644 index 000000000000..4d5e6d47ba13 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/ConnectorsClient.java @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.ConnectorSettingInner; + +/** An instance of this class provides access to all the operations defined in ConnectorsClient. */ +public interface ConnectorsClient { + /** + * Cloud accounts connectors of a subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return for a subscription, list of all cloud account connectors and their settings. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Cloud accounts connectors of a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return for a subscription, list of all cloud account connectors and their settings. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * Details of a specific cloud account connector. + * + * @param connectorName Name of the cloud account connector. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the connector setting. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ConnectorSettingInner get(String connectorName); + + /** + * Details of a specific cloud account connector. + * + * @param connectorName Name of the cloud account connector. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the connector setting. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String connectorName, Context context); + + /** + * Create a cloud account connector or update an existing one. Connect to your cloud account. For AWS, use either + * account credentials or role-based authentication. For GCP, use account organization credentials. + * + * @param connectorName Name of the cloud account connector. + * @param connectorSetting Settings for the cloud account connector. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the connector setting. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ConnectorSettingInner createOrUpdate(String connectorName, ConnectorSettingInner connectorSetting); + + /** + * Create a cloud account connector or update an existing one. Connect to your cloud account. For AWS, use either + * account credentials or role-based authentication. For GCP, use account organization credentials. + * + * @param connectorName Name of the cloud account connector. + * @param connectorSetting Settings for the cloud account connector. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the connector setting. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String connectorName, ConnectorSettingInner connectorSetting, Context context); + + /** + * Delete a cloud account connector from a subscription. + * + * @param connectorName Name of the cloud account connector. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String connectorName); + + /** + * Delete a cloud account connector from a subscription. + * + * @param connectorName Name of the cloud account connector. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String connectorName, Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/DeviceSecurityGroupsClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/DeviceSecurityGroupsClient.java new file mode 100644 index 000000000000..4c8b55d0b84e --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/DeviceSecurityGroupsClient.java @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.DeviceSecurityGroupInner; + +/** An instance of this class provides access to all the operations defined in DeviceSecurityGroupsClient. */ +public interface DeviceSecurityGroupsClient { + /** + * Use this method get the list of device security groups for the specified IoT Hub resource. + * + * @param resourceId The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of device security groups. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceId); + + /** + * Use this method get the list of device security groups for the specified IoT Hub resource. + * + * @param resourceId The identifier of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of device security groups. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceId, Context context); + + /** + * Use this method to get the device security group for the specified IoT Hub resource. + * + * @param resourceId The identifier of the resource. + * @param deviceSecurityGroupName The name of the device security group. Note that the name of the device security + * group is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the device security group resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DeviceSecurityGroupInner get(String resourceId, String deviceSecurityGroupName); + + /** + * Use this method to get the device security group for the specified IoT Hub resource. + * + * @param resourceId The identifier of the resource. + * @param deviceSecurityGroupName The name of the device security group. Note that the name of the device security + * group is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the device security group resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceId, String deviceSecurityGroupName, Context context); + + /** + * Use this method to creates or updates the device security group on a specified IoT Hub resource. + * + * @param resourceId The identifier of the resource. + * @param deviceSecurityGroupName The name of the device security group. Note that the name of the device security + * group is case insensitive. + * @param deviceSecurityGroup Security group object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the device security group resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DeviceSecurityGroupInner createOrUpdate( + String resourceId, String deviceSecurityGroupName, DeviceSecurityGroupInner deviceSecurityGroup); + + /** + * Use this method to creates or updates the device security group on a specified IoT Hub resource. + * + * @param resourceId The identifier of the resource. + * @param deviceSecurityGroupName The name of the device security group. Note that the name of the device security + * group is case insensitive. + * @param deviceSecurityGroup Security group object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the device security group resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceId, + String deviceSecurityGroupName, + DeviceSecurityGroupInner deviceSecurityGroup, + Context context); + + /** + * User this method to deletes the device security group. + * + * @param resourceId The identifier of the resource. + * @param deviceSecurityGroupName The name of the device security group. Note that the name of the device security + * group is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceId, String deviceSecurityGroupName); + + /** + * User this method to deletes the device security group. + * + * @param resourceId The identifier of the resource. + * @param deviceSecurityGroupName The name of the device security group. Note that the name of the device security + * group is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String resourceId, String deviceSecurityGroupName, Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/DevicesClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/DevicesClient.java new file mode 100644 index 000000000000..90532443f9ff --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/DevicesClient.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.DeviceInner; + +/** An instance of this class provides access to all the operations defined in DevicesClient. */ +public interface DevicesClient { + /** + * Get device. + * + * @param resourceId The identifier of the resource. + * @param deviceId Identifier of the device. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return device. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DeviceInner get(String resourceId, String deviceId); + + /** + * Get device. + * + * @param resourceId The identifier of the resource. + * @param deviceId Identifier of the device. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return device. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceId, String deviceId, Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/DevicesForHubsClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/DevicesForHubsClient.java new file mode 100644 index 000000000000..69f002544a43 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/DevicesForHubsClient.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.DeviceInner; +import com.azure.resourcemanager.security.models.ManagementState; + +/** An instance of this class provides access to all the operations defined in DevicesForHubsClient. */ +public interface DevicesForHubsClient { + /** + * Get list of the devices for the specified IoT Hub resource. + * + * @param resourceId The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of the devices for the specified IoT Hub resource. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceId); + + /** + * Get list of the devices for the specified IoT Hub resource. + * + * @param resourceId The identifier of the resource. + * @param limit Limit the number of items returned in a single page. + * @param skipToken Skip token used for pagination. + * @param deviceManagementType Get devices only from specific type, Managed or Unmanaged. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of the devices for the specified IoT Hub resource. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String resourceId, Integer limit, String skipToken, ManagementState deviceManagementType, Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/DevicesForSubscriptionsClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/DevicesForSubscriptionsClient.java new file mode 100644 index 000000000000..155c79771103 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/DevicesForSubscriptionsClient.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.DeviceInner; +import com.azure.resourcemanager.security.models.ManagementState; + +/** An instance of this class provides access to all the operations defined in DevicesForSubscriptionsClient. */ +public interface DevicesForSubscriptionsClient { + /** + * Get list of the devices by their subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of the devices by their subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Get list of the devices by their subscription. + * + * @param limit Limit the number of items returned in a single page. + * @param skipToken Skip token used for pagination. + * @param deviceManagementType Get devices only from specific type, Managed or Unmanaged. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of the devices by their subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + Integer limit, String skipToken, ManagementState deviceManagementType, Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/DiscoveredSecuritySolutionsClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/DiscoveredSecuritySolutionsClient.java new file mode 100644 index 000000000000..cffe25fb5761 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/DiscoveredSecuritySolutionsClient.java @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.DiscoveredSecuritySolutionInner; + +/** An instance of this class provides access to all the operations defined in DiscoveredSecuritySolutionsClient. */ +public interface DiscoveredSecuritySolutionsClient { + /** + * Gets a list of discovered Security Solutions for the subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of discovered Security Solutions for the subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Gets a list of discovered Security Solutions for the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of discovered Security Solutions for the subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * Gets a list of discovered Security Solutions for the subscription and location. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of discovered Security Solutions for the subscription and location. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByHomeRegion(String ascLocation); + + /** + * Gets a list of discovered Security Solutions for the subscription and location. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of discovered Security Solutions for the subscription and location. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByHomeRegion(String ascLocation, Context context); + + /** + * Gets a specific discovered Security Solution. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param discoveredSecuritySolutionName Name of a discovered security solution. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a specific discovered Security Solution. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DiscoveredSecuritySolutionInner get( + String resourceGroupName, String ascLocation, String discoveredSecuritySolutionName); + + /** + * Gets a specific discovered Security Solution. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param discoveredSecuritySolutionName Name of a discovered security solution. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a specific discovered Security Solution. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String ascLocation, String discoveredSecuritySolutionName, Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/ExternalSecuritySolutionsClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/ExternalSecuritySolutionsClient.java new file mode 100644 index 000000000000..33fe6f92a327 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/ExternalSecuritySolutionsClient.java @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.ExternalSecuritySolutionInner; + +/** An instance of this class provides access to all the operations defined in ExternalSecuritySolutionsClient. */ +public interface ExternalSecuritySolutionsClient { + /** + * Gets a list of external security solutions for the subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of external security solutions for the subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Gets a list of external security solutions for the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of external security solutions for the subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * Gets a list of external Security Solutions for the subscription and location. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of external Security Solutions for the subscription and location. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByHomeRegion(String ascLocation); + + /** + * Gets a list of external Security Solutions for the subscription and location. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of external Security Solutions for the subscription and location. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByHomeRegion(String ascLocation, Context context); + + /** + * Gets a specific external Security Solution. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param externalSecuritySolutionsName Name of an external security solution. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a specific external Security Solution. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ExternalSecuritySolutionInner get( + String resourceGroupName, String ascLocation, String externalSecuritySolutionsName); + + /** + * Gets a specific external Security Solution. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param externalSecuritySolutionsName Name of an external security solution. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a specific external Security Solution. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String ascLocation, String externalSecuritySolutionsName, Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/InformationProtectionPoliciesClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/InformationProtectionPoliciesClient.java new file mode 100644 index 000000000000..f38b0eab073d --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/InformationProtectionPoliciesClient.java @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.InformationProtectionPolicyInner; +import com.azure.resourcemanager.security.models.InformationProtectionPoliciesInformationProtectionPolicyName; + +/** An instance of this class provides access to all the operations defined in InformationProtectionPoliciesClient. */ +public interface InformationProtectionPoliciesClient { + /** + * Details of the information protection policy. + * + * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @param informationProtectionPolicyName Name of the information protection policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information protection policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + InformationProtectionPolicyInner get( + String scope, InformationProtectionPoliciesInformationProtectionPolicyName informationProtectionPolicyName); + + /** + * Details of the information protection policy. + * + * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @param informationProtectionPolicyName Name of the information protection policy. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information protection policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String scope, + InformationProtectionPoliciesInformationProtectionPolicyName informationProtectionPolicyName, + Context context); + + /** + * Details of the information protection policy. + * + * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @param informationProtectionPolicyName Name of the information protection policy. + * @param informationProtectionPolicy Information protection policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information protection policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + InformationProtectionPolicyInner createOrUpdate( + String scope, + InformationProtectionPoliciesInformationProtectionPolicyName informationProtectionPolicyName, + InformationProtectionPolicyInner informationProtectionPolicy); + + /** + * Details of the information protection policy. + * + * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @param informationProtectionPolicyName Name of the information protection policy. + * @param informationProtectionPolicy Information protection policy. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information protection policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String scope, + InformationProtectionPoliciesInformationProtectionPolicyName informationProtectionPolicyName, + InformationProtectionPolicyInner informationProtectionPolicy, + Context context); + + /** + * Information protection policies of a specific management group. + * + * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information protection policies response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String scope); + + /** + * Information protection policies of a specific management group. + * + * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information protection policies response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String scope, Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/IngestionSettingsClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/IngestionSettingsClient.java new file mode 100644 index 000000000000..12a83684c271 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/IngestionSettingsClient.java @@ -0,0 +1,166 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.ConnectionStringsInner; +import com.azure.resourcemanager.security.fluent.models.IngestionSettingInner; +import com.azure.resourcemanager.security.fluent.models.IngestionSettingTokenInner; + +/** An instance of this class provides access to all the operations defined in IngestionSettingsClient. */ +public interface IngestionSettingsClient { + /** + * Settings for ingesting security data and logs to correlate with resources associated with the subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of ingestion settings. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Settings for ingesting security data and logs to correlate with resources associated with the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of ingestion settings. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * Settings for ingesting security data and logs to correlate with resources associated with the subscription. + * + * @param ingestionSettingName Name of the ingestion setting. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return configures how to correlate scan data and logs with resources associated with the subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + IngestionSettingInner get(String ingestionSettingName); + + /** + * Settings for ingesting security data and logs to correlate with resources associated with the subscription. + * + * @param ingestionSettingName Name of the ingestion setting. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return configures how to correlate scan data and logs with resources associated with the subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String ingestionSettingName, Context context); + + /** + * Create setting for ingesting security data and logs to correlate with resources associated with the subscription. + * + * @param ingestionSettingName Name of the ingestion setting. + * @param ingestionSetting Ingestion setting object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return configures how to correlate scan data and logs with resources associated with the subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + IngestionSettingInner create(String ingestionSettingName, IngestionSettingInner ingestionSetting); + + /** + * Create setting for ingesting security data and logs to correlate with resources associated with the subscription. + * + * @param ingestionSettingName Name of the ingestion setting. + * @param ingestionSetting Ingestion setting object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return configures how to correlate scan data and logs with resources associated with the subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createWithResponse( + String ingestionSettingName, IngestionSettingInner ingestionSetting, Context context); + + /** + * Deletes the ingestion settings for this subscription. + * + * @param ingestionSettingName Name of the ingestion setting. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String ingestionSettingName); + + /** + * Deletes the ingestion settings for this subscription. + * + * @param ingestionSettingName Name of the ingestion setting. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String ingestionSettingName, Context context); + + /** + * Returns the token that is used for correlating ingested telemetry with the resources in the subscription. + * + * @param ingestionSettingName Name of the ingestion setting. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return configures how to correlate scan data and logs with resources associated with the subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + IngestionSettingTokenInner listTokens(String ingestionSettingName); + + /** + * Returns the token that is used for correlating ingested telemetry with the resources in the subscription. + * + * @param ingestionSettingName Name of the ingestion setting. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return configures how to correlate scan data and logs with resources associated with the subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listTokensWithResponse(String ingestionSettingName, Context context); + + /** + * Connection strings for ingesting security scan logs and data. + * + * @param ingestionSettingName Name of the ingestion setting. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return connection string for ingesting security data and logs. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ConnectionStringsInner listConnectionStrings(String ingestionSettingName); + + /** + * Connection strings for ingesting security scan logs and data. + * + * @param ingestionSettingName Name of the ingestion setting. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return connection string for ingesting security data and logs. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listConnectionStringsWithResponse(String ingestionSettingName, Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/IotAlertTypesClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/IotAlertTypesClient.java new file mode 100644 index 000000000000..c61e6ae4bc96 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/IotAlertTypesClient.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.IotAlertTypeInner; +import com.azure.resourcemanager.security.fluent.models.IotAlertTypeListInner; + +/** An instance of this class provides access to all the operations defined in IotAlertTypesClient. */ +public interface IotAlertTypesClient { + /** + * List IoT alert types. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of alert types. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + IotAlertTypeListInner list(); + + /** + * List IoT alert types. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of alert types. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listWithResponse(Context context); + + /** + * Get IoT alert type. + * + * @param iotAlertTypeName Name of the alert type. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT alert type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + IotAlertTypeInner get(String iotAlertTypeName); + + /** + * Get IoT alert type. + * + * @param iotAlertTypeName Name of the alert type. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT alert type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String iotAlertTypeName, Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/IotAlertsClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/IotAlertsClient.java new file mode 100644 index 000000000000..add204e53a99 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/IotAlertsClient.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.IotAlertModelInner; +import com.azure.resourcemanager.security.models.ManagementState; + +/** An instance of this class provides access to all the operations defined in IotAlertsClient. */ +public interface IotAlertsClient { + /** + * List IoT alerts. + * + * @param scope Scope of the query: Subscription (i.e. /subscriptions/{subscriptionId}) or IoT Hub (i.e. + * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Devices/iotHubs/{iotHubName}). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of IoT alerts. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String scope); + + /** + * List IoT alerts. + * + * @param scope Scope of the query: Subscription (i.e. /subscriptions/{subscriptionId}) or IoT Hub (i.e. + * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Devices/iotHubs/{iotHubName}). + * @param minStartTimeUtc Filter by minimum startTimeUtc (ISO 8601 format). + * @param maxStartTimeUtc Filter by maximum startTimeUtc (ISO 8601 format). + * @param alertType Filter by alert type. + * @param deviceManagementType Get devices only from specific type, Managed or Unmanaged. + * @param compromisedEntity Filter by compromised device. + * @param limit Limit the number of items returned in a single page. + * @param skipToken Skip token used for pagination. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of IoT alerts. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String scope, + String minStartTimeUtc, + String maxStartTimeUtc, + String alertType, + ManagementState deviceManagementType, + String compromisedEntity, + Integer limit, + String skipToken, + Context context); + + /** + * Get IoT alert. + * + * @param scope Scope of the query: Subscription (i.e. /subscriptions/{subscriptionId}) or IoT Hub (i.e. + * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Devices/iotHubs/{iotHubName}). + * @param iotAlertId Id of the alert. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT alert. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + IotAlertModelInner get(String scope, String iotAlertId); + + /** + * Get IoT alert. + * + * @param scope Scope of the query: Subscription (i.e. /subscriptions/{subscriptionId}) or IoT Hub (i.e. + * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Devices/iotHubs/{iotHubName}). + * @param iotAlertId Id of the alert. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT alert. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String scope, String iotAlertId, Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/IotDefenderSettingsClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/IotDefenderSettingsClient.java new file mode 100644 index 000000000000..2fc29dca0093 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/IotDefenderSettingsClient.java @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.StreamResponse; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.IotDefenderSettingsListInner; +import com.azure.resourcemanager.security.fluent.models.IotDefenderSettingsModelInner; +import com.azure.resourcemanager.security.fluent.models.PackageDownloadsInner; +import java.io.InputStream; + +/** An instance of this class provides access to all the operations defined in IotDefenderSettingsClient. */ +public interface IotDefenderSettingsClient { + /** + * List IoT Defender Settings. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of IoT Defender settings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + IotDefenderSettingsListInner list(); + + /** + * List IoT Defender Settings. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of IoT Defender settings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listWithResponse(Context context); + + /** + * Get IoT Defender Settings. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT Defender Settings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + IotDefenderSettingsModelInner get(); + + /** + * Get IoT Defender Settings. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT Defender Settings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(Context context); + + /** + * Create or update IoT Defender settings. + * + * @param iotDefenderSettingsModel The IoT defender settings model. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT Defender settings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + IotDefenderSettingsModelInner createOrUpdate(IotDefenderSettingsModelInner iotDefenderSettingsModel); + + /** + * Create or update IoT Defender settings. + * + * @param iotDefenderSettingsModel The IoT defender settings model. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT Defender settings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + IotDefenderSettingsModelInner iotDefenderSettingsModel, Context context); + + /** + * Delete IoT Defender settings. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(); + + /** + * Delete IoT Defender settings. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(Context context); + + /** + * Information about downloadable packages. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about package downloads. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PackageDownloadsInner packageDownloads(); + + /** + * Information about downloadable packages. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about package downloads. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response packageDownloadsWithResponse(Context context); + + /** + * Download manager activation data defined for this subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + InputStream downloadManagerActivation(); + + /** + * Download manager activation data defined for this subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + StreamResponse downloadManagerActivationWithResponse(Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/IotRecommendationTypesClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/IotRecommendationTypesClient.java new file mode 100644 index 000000000000..73ef2991f597 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/IotRecommendationTypesClient.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.IotRecommendationTypeInner; +import com.azure.resourcemanager.security.fluent.models.IotRecommendationTypeListInner; + +/** An instance of this class provides access to all the operations defined in IotRecommendationTypesClient. */ +public interface IotRecommendationTypesClient { + /** + * List IoT recommendation types. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of recommendation types. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + IotRecommendationTypeListInner list(); + + /** + * List IoT recommendation types. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of recommendation types. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listWithResponse(Context context); + + /** + * Get IoT recommendation type. + * + * @param iotRecommendationTypeName Name of the recommendation type. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT recommendation type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + IotRecommendationTypeInner get(String iotRecommendationTypeName); + + /** + * Get IoT recommendation type. + * + * @param iotRecommendationTypeName Name of the recommendation type. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT recommendation type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String iotRecommendationTypeName, Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/IotRecommendationsClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/IotRecommendationsClient.java new file mode 100644 index 000000000000..8d800d83f319 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/IotRecommendationsClient.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.IotRecommendationModelInner; + +/** An instance of this class provides access to all the operations defined in IotRecommendationsClient. */ +public interface IotRecommendationsClient { + /** + * List IoT recommendations. + * + * @param scope Scope of the query: Subscription (i.e. /subscriptions/{subscriptionId}) or IoT Hub (i.e. + * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Devices/iotHubs/{iotHubName}). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of IoT recommendations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String scope); + + /** + * List IoT recommendations. + * + * @param scope Scope of the query: Subscription (i.e. /subscriptions/{subscriptionId}) or IoT Hub (i.e. + * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Devices/iotHubs/{iotHubName}). + * @param recommendationType Filter by recommendation type. + * @param deviceId Filter by device id. + * @param limit Limit the number of items returned in a single page. + * @param skipToken Skip token used for pagination. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of IoT recommendations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String scope, String recommendationType, String deviceId, Integer limit, String skipToken, Context context); + + /** + * Get IoT recommendation. + * + * @param scope Scope of the query: Subscription (i.e. /subscriptions/{subscriptionId}) or IoT Hub (i.e. + * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Devices/iotHubs/{iotHubName}). + * @param iotRecommendationId Id of the recommendation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT recommendation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + IotRecommendationModelInner get(String scope, String iotRecommendationId); + + /** + * Get IoT recommendation. + * + * @param scope Scope of the query: Subscription (i.e. /subscriptions/{subscriptionId}) or IoT Hub (i.e. + * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Devices/iotHubs/{iotHubName}). + * @param iotRecommendationId Id of the recommendation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT recommendation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String scope, String iotRecommendationId, Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/IotSecuritySolutionAnalyticsClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/IotSecuritySolutionAnalyticsClient.java new file mode 100644 index 000000000000..f8b3923def91 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/IotSecuritySolutionAnalyticsClient.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.IoTSecuritySolutionAnalyticsModelInner; +import com.azure.resourcemanager.security.fluent.models.IoTSecuritySolutionAnalyticsModelListInner; + +/** An instance of this class provides access to all the operations defined in IotSecuritySolutionAnalyticsClient. */ +public interface IotSecuritySolutionAnalyticsClient { + /** + * Use this method to get IoT security Analytics metrics in an array. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param solutionName The name of the IoT Security solution. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Security analytics of your IoT Security solution. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + IoTSecuritySolutionAnalyticsModelListInner list(String resourceGroupName, String solutionName); + + /** + * Use this method to get IoT security Analytics metrics in an array. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param solutionName The name of the IoT Security solution. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Security analytics of your IoT Security solution. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listWithResponse( + String resourceGroupName, String solutionName, Context context); + + /** + * Use this method to get IoT Security Analytics metrics. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param solutionName The name of the IoT Security solution. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return security analytics of your IoT Security solution. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + IoTSecuritySolutionAnalyticsModelInner get(String resourceGroupName, String solutionName); + + /** + * Use this method to get IoT Security Analytics metrics. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param solutionName The name of the IoT Security solution. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return security analytics of your IoT Security solution. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String solutionName, Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/IotSecuritySolutionsAnalyticsAggregatedAlertsClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/IotSecuritySolutionsAnalyticsAggregatedAlertsClient.java new file mode 100644 index 000000000000..5f8cd88af1f7 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/IotSecuritySolutionsAnalyticsAggregatedAlertsClient.java @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.IoTSecurityAggregatedAlertInner; + +/** + * An instance of this class provides access to all the operations defined in + * IotSecuritySolutionsAnalyticsAggregatedAlertsClient. + */ +public interface IotSecuritySolutionsAnalyticsAggregatedAlertsClient { + /** + * Use this method to get the aggregated alert list of yours IoT Security solution. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param solutionName The name of the IoT Security solution. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of IoT Security solution aggregated alert data. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String solutionName); + + /** + * Use this method to get the aggregated alert list of yours IoT Security solution. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param solutionName The name of the IoT Security solution. + * @param top Number of results to retrieve. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of IoT Security solution aggregated alert data. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String resourceGroupName, String solutionName, Integer top, Context context); + + /** + * Use this method to get a single the aggregated alert of yours IoT Security solution. This aggregation is + * performed by alert name. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param solutionName The name of the IoT Security solution. + * @param aggregatedAlertName Identifier of the aggregated alert. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return security Solution Aggregated Alert information. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + IoTSecurityAggregatedAlertInner get(String resourceGroupName, String solutionName, String aggregatedAlertName); + + /** + * Use this method to get a single the aggregated alert of yours IoT Security solution. This aggregation is + * performed by alert name. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param solutionName The name of the IoT Security solution. + * @param aggregatedAlertName Identifier of the aggregated alert. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return security Solution Aggregated Alert information. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String solutionName, String aggregatedAlertName, Context context); + + /** + * Use this method to dismiss an aggregated IoT Security Solution Alert. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param solutionName The name of the IoT Security solution. + * @param aggregatedAlertName Identifier of the aggregated alert. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void dismiss(String resourceGroupName, String solutionName, String aggregatedAlertName); + + /** + * Use this method to dismiss an aggregated IoT Security Solution Alert. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param solutionName The name of the IoT Security solution. + * @param aggregatedAlertName Identifier of the aggregated alert. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response dismissWithResponse( + String resourceGroupName, String solutionName, String aggregatedAlertName, Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/IotSecuritySolutionsAnalyticsRecommendationsClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/IotSecuritySolutionsAnalyticsRecommendationsClient.java new file mode 100644 index 000000000000..4f28948d08b9 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/IotSecuritySolutionsAnalyticsRecommendationsClient.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.IoTSecurityAggregatedRecommendationInner; + +/** + * An instance of this class provides access to all the operations defined in + * IotSecuritySolutionsAnalyticsRecommendationsClient. + */ +public interface IotSecuritySolutionsAnalyticsRecommendationsClient { + /** + * Use this method to get the aggregated security analytics recommendation of yours IoT Security solution. This + * aggregation is performed by recommendation name. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param solutionName The name of the IoT Security solution. + * @param aggregatedRecommendationName Name of the recommendation aggregated for this query. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT Security solution recommendation information. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + IoTSecurityAggregatedRecommendationInner get( + String resourceGroupName, String solutionName, String aggregatedRecommendationName); + + /** + * Use this method to get the aggregated security analytics recommendation of yours IoT Security solution. This + * aggregation is performed by recommendation name. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param solutionName The name of the IoT Security solution. + * @param aggregatedRecommendationName Name of the recommendation aggregated for this query. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT Security solution recommendation information. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String solutionName, String aggregatedRecommendationName, Context context); + + /** + * Use this method to get the list of aggregated security analytics recommendations of yours IoT Security solution. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param solutionName The name of the IoT Security solution. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of IoT Security solution aggregated recommendations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String solutionName); + + /** + * Use this method to get the list of aggregated security analytics recommendations of yours IoT Security solution. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param solutionName The name of the IoT Security solution. + * @param top Number of results to retrieve. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of IoT Security solution aggregated recommendations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String resourceGroupName, String solutionName, Integer top, Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/IotSecuritySolutionsClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/IotSecuritySolutionsClient.java new file mode 100644 index 000000000000..054c973f186c --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/IotSecuritySolutionsClient.java @@ -0,0 +1,200 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.IoTSecuritySolutionModelInner; +import com.azure.resourcemanager.security.models.UpdateIotSecuritySolutionData; + +/** An instance of this class provides access to all the operations defined in IotSecuritySolutionsClient. */ +public interface IotSecuritySolutionsClient { + /** + * Use this method to get the list of IoT Security solutions by subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of IoT Security solutions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Use this method to get the list of IoT Security solutions by subscription. + * + * @param filter Filter the IoT Security solution with OData syntax. Supports filtering by iotHubs. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of IoT Security solutions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String filter, Context context); + + /** + * Use this method to get the list IoT Security solutions organized by resource group. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of IoT Security solutions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Use this method to get the list IoT Security solutions organized by resource group. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param filter Filter the IoT Security solution with OData syntax. Supports filtering by iotHubs. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of IoT Security solutions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup( + String resourceGroupName, String filter, Context context); + + /** + * User this method to get details of a specific IoT Security solution based on solution name. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param solutionName The name of the IoT Security solution. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT Security solution configuration and resource information. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + IoTSecuritySolutionModelInner getByResourceGroup(String resourceGroupName, String solutionName); + + /** + * User this method to get details of a specific IoT Security solution based on solution name. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param solutionName The name of the IoT Security solution. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT Security solution configuration and resource information. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String solutionName, Context context); + + /** + * Use this method to create or update yours IoT Security solution. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param solutionName The name of the IoT Security solution. + * @param iotSecuritySolutionData The security solution data. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT Security solution configuration and resource information. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + IoTSecuritySolutionModelInner createOrUpdate( + String resourceGroupName, String solutionName, IoTSecuritySolutionModelInner iotSecuritySolutionData); + + /** + * Use this method to create or update yours IoT Security solution. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param solutionName The name of the IoT Security solution. + * @param iotSecuritySolutionData The security solution data. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT Security solution configuration and resource information. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, + String solutionName, + IoTSecuritySolutionModelInner iotSecuritySolutionData, + Context context); + + /** + * Use this method to update existing IoT Security solution tags or user defined resources. To update other fields + * use the CreateOrUpdate method. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param solutionName The name of the IoT Security solution. + * @param updateIotSecuritySolutionData The security solution data. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT Security solution configuration and resource information. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + IoTSecuritySolutionModelInner update( + String resourceGroupName, String solutionName, UpdateIotSecuritySolutionData updateIotSecuritySolutionData); + + /** + * Use this method to update existing IoT Security solution tags or user defined resources. To update other fields + * use the CreateOrUpdate method. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param solutionName The name of the IoT Security solution. + * @param updateIotSecuritySolutionData The security solution data. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT Security solution configuration and resource information. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, + String solutionName, + UpdateIotSecuritySolutionData updateIotSecuritySolutionData, + Context context); + + /** + * Use this method to delete yours IoT Security solution. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param solutionName The name of the IoT Security solution. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String solutionName); + + /** + * Use this method to delete yours IoT Security solution. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param solutionName The name of the IoT Security solution. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String resourceGroupName, String solutionName, Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/IotSensorsClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/IotSensorsClient.java new file mode 100644 index 000000000000..6ea5cb5022dc --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/IotSensorsClient.java @@ -0,0 +1,209 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.StreamResponse; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.IotSensorsListInner; +import com.azure.resourcemanager.security.fluent.models.IotSensorsModelInner; +import com.azure.resourcemanager.security.models.ResetPasswordInput; +import java.io.InputStream; + +/** An instance of this class provides access to all the operations defined in IotSensorsClient. */ +public interface IotSensorsClient { + /** + * List IoT sensors. + * + * @param scope Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of IoT sensors. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + IotSensorsListInner list(String scope); + + /** + * List IoT sensors. + * + * @param scope Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of IoT sensors. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listWithResponse(String scope, Context context); + + /** + * Get IoT sensor. + * + * @param scope Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub). + * @param iotSensorName Name of the IoT sensor. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT sensor. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + IotSensorsModelInner get(String scope, String iotSensorName); + + /** + * Get IoT sensor. + * + * @param scope Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub). + * @param iotSensorName Name of the IoT sensor. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT sensor. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String scope, String iotSensorName, Context context); + + /** + * Create or update IoT sensor. + * + * @param scope Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub). + * @param iotSensorName Name of the IoT sensor. + * @param iotSensorsModel The IoT sensor model. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT sensor model. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + IotSensorsModelInner createOrUpdate(String scope, String iotSensorName, IotSensorsModelInner iotSensorsModel); + + /** + * Create or update IoT sensor. + * + * @param scope Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub). + * @param iotSensorName Name of the IoT sensor. + * @param iotSensorsModel The IoT sensor model. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT sensor model. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String scope, String iotSensorName, IotSensorsModelInner iotSensorsModel, Context context); + + /** + * Delete IoT sensor. + * + * @param scope Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub). + * @param iotSensorName Name of the IoT sensor. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String scope, String iotSensorName); + + /** + * Delete IoT sensor. + * + * @param scope Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub). + * @param iotSensorName Name of the IoT sensor. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String scope, String iotSensorName, Context context); + + /** + * Download sensor activation file. + * + * @param scope Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub). + * @param iotSensorName Name of the IoT sensor. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + InputStream downloadActivation(String scope, String iotSensorName); + + /** + * Download sensor activation file. + * + * @param scope Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub). + * @param iotSensorName Name of the IoT sensor. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + StreamResponse downloadActivationWithResponse(String scope, String iotSensorName, Context context); + + /** + * Download file for reset password of the sensor. + * + * @param scope Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub). + * @param iotSensorName Name of the IoT sensor. + * @param body The reset password input. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + InputStream downloadResetPassword(String scope, String iotSensorName, ResetPasswordInput body); + + /** + * Download file for reset password of the sensor. + * + * @param scope Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub). + * @param iotSensorName Name of the IoT sensor. + * @param body The reset password input. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + StreamResponse downloadResetPasswordWithResponse( + String scope, String iotSensorName, ResetPasswordInput body, Context context); + + /** + * Trigger threat intelligence package update. + * + * @param scope Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub). + * @param iotSensorName Name of the IoT sensor. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void triggerTiPackageUpdate(String scope, String iotSensorName); + + /** + * Trigger threat intelligence package update. + * + * @param scope Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub). + * @param iotSensorName Name of the IoT sensor. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response triggerTiPackageUpdateWithResponse(String scope, String iotSensorName, Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/IotSitesClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/IotSitesClient.java new file mode 100644 index 000000000000..4945f8bc0f1d --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/IotSitesClient.java @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.IotSitesListInner; +import com.azure.resourcemanager.security.fluent.models.IotSitesModelInner; + +/** An instance of this class provides access to all the operations defined in IotSitesClient. */ +public interface IotSitesClient { + /** + * List IoT sites. + * + * @param scope Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of IoT sites. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + IotSitesListInner list(String scope); + + /** + * List IoT sites. + * + * @param scope Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of IoT sites. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listWithResponse(String scope, Context context); + + /** + * Get IoT site. + * + * @param scope Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT site. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + IotSitesModelInner get(String scope); + + /** + * Get IoT site. + * + * @param scope Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT site. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String scope, Context context); + + /** + * Create or update IoT site. + * + * @param scope Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub). + * @param iotSitesModel The IoT sites model. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT site model. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + IotSitesModelInner createOrUpdate(String scope, IotSitesModelInner iotSitesModel); + + /** + * Create or update IoT site. + * + * @param scope Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub). + * @param iotSitesModel The IoT sites model. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT site model. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String scope, IotSitesModelInner iotSitesModel, Context context); + + /** + * Delete IoT site. + * + * @param scope Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String scope); + + /** + * Delete IoT site. + * + * @param scope Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String scope, Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/JitNetworkAccessPoliciesClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/JitNetworkAccessPoliciesClient.java new file mode 100644 index 000000000000..d3629d77084a --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/JitNetworkAccessPoliciesClient.java @@ -0,0 +1,281 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.JitNetworkAccessPolicyInner; +import com.azure.resourcemanager.security.fluent.models.JitNetworkAccessRequestInner; +import com.azure.resourcemanager.security.models.JitNetworkAccessPolicyInitiateRequest; + +/** An instance of this class provides access to all the operations defined in JitNetworkAccessPoliciesClient. */ +public interface JitNetworkAccessPoliciesClient { + /** + * Policies for protecting resources using Just-in-Time access control. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Policies for protecting resources using Just-in-Time access control. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * Policies for protecting resources using Just-in-Time access control for the subscription, location. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByRegion(String ascLocation); + + /** + * Policies for protecting resources using Just-in-Time access control for the subscription, location. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByRegion(String ascLocation, Context context); + + /** + * Policies for protecting resources using Just-in-Time access control for the subscription, location. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Policies for protecting resources using Just-in-Time access control for the subscription, location. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Policies for protecting resources using Just-in-Time access control for the subscription, location. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroupAndRegion( + String resourceGroupName, String ascLocation); + + /** + * Policies for protecting resources using Just-in-Time access control for the subscription, location. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroupAndRegion( + String resourceGroupName, String ascLocation, Context context); + + /** + * Policies for protecting resources using Just-in-Time access control for the subscription, location. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param jitNetworkAccessPolicyName Name of a Just-in-Time access configuration policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + JitNetworkAccessPolicyInner get(String resourceGroupName, String ascLocation, String jitNetworkAccessPolicyName); + + /** + * Policies for protecting resources using Just-in-Time access control for the subscription, location. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param jitNetworkAccessPolicyName Name of a Just-in-Time access configuration policy. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String ascLocation, String jitNetworkAccessPolicyName, Context context); + + /** + * Create a policy for protecting resources using Just-in-Time access control. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param jitNetworkAccessPolicyName Name of a Just-in-Time access configuration policy. + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + JitNetworkAccessPolicyInner createOrUpdate( + String resourceGroupName, + String ascLocation, + String jitNetworkAccessPolicyName, + JitNetworkAccessPolicyInner body); + + /** + * Create a policy for protecting resources using Just-in-Time access control. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param jitNetworkAccessPolicyName Name of a Just-in-Time access configuration policy. + * @param body The body parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, + String ascLocation, + String jitNetworkAccessPolicyName, + JitNetworkAccessPolicyInner body, + Context context); + + /** + * Delete a Just-in-Time access control policy. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param jitNetworkAccessPolicyName Name of a Just-in-Time access configuration policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String ascLocation, String jitNetworkAccessPolicyName); + + /** + * Delete a Just-in-Time access control policy. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param jitNetworkAccessPolicyName Name of a Just-in-Time access configuration policy. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse( + String resourceGroupName, String ascLocation, String jitNetworkAccessPolicyName, Context context); + + /** + * Initiate a JIT access from a specific Just-in-Time policy configuration. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param jitNetworkAccessPolicyName Name of a Just-in-Time access configuration policy. + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + JitNetworkAccessRequestInner initiate( + String resourceGroupName, + String ascLocation, + String jitNetworkAccessPolicyName, + JitNetworkAccessPolicyInitiateRequest body); + + /** + * Initiate a JIT access from a specific Just-in-Time policy configuration. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param jitNetworkAccessPolicyName Name of a Just-in-Time access configuration policy. + * @param body The body parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response initiateWithResponse( + String resourceGroupName, + String ascLocation, + String jitNetworkAccessPolicyName, + JitNetworkAccessPolicyInitiateRequest body, + Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/LocationsClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/LocationsClient.java new file mode 100644 index 000000000000..3afa964f5cc9 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/LocationsClient.java @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.AscLocationInner; + +/** An instance of this class provides access to all the operations defined in LocationsClient. */ +public interface LocationsClient { + /** + * The location of the responsible ASC of the specific subscription (home region). For each subscription there is + * only one responsible location. The location in the response should be used to read or write other resources in + * ASC according to their ID. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of locations where ASC saves your data. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * The location of the responsible ASC of the specific subscription (home region). For each subscription there is + * only one responsible location. The location in the response should be used to read or write other resources in + * ASC according to their ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of locations where ASC saves your data. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * Details of a specific location. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the ASC location of the subscription is in the "name" field. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AscLocationInner get(String ascLocation); + + /** + * Details of a specific location. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the ASC location of the subscription is in the "name" field. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String ascLocation, Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/OnPremiseIotSensorsClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/OnPremiseIotSensorsClient.java new file mode 100644 index 000000000000..726cda7fbdbd --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/OnPremiseIotSensorsClient.java @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.StreamResponse; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.OnPremiseIotSensorInner; +import com.azure.resourcemanager.security.fluent.models.OnPremiseIotSensorsListInner; +import com.azure.resourcemanager.security.models.ResetPasswordInput; +import java.io.InputStream; + +/** An instance of this class provides access to all the operations defined in OnPremiseIotSensorsClient. */ +public interface OnPremiseIotSensorsClient { + /** + * List on-premise IoT sensors. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of on-premise IoT sensors. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + OnPremiseIotSensorsListInner list(); + + /** + * List on-premise IoT sensors. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of on-premise IoT sensors. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listWithResponse(Context context); + + /** + * Get on-premise IoT sensor. + * + * @param onPremiseIotSensorName Name of the on-premise IoT sensor. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return on-premise IoT sensor. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + OnPremiseIotSensorInner get(String onPremiseIotSensorName); + + /** + * Get on-premise IoT sensor. + * + * @param onPremiseIotSensorName Name of the on-premise IoT sensor. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return on-premise IoT sensor. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String onPremiseIotSensorName, Context context); + + /** + * Create or update on-premise IoT sensor. + * + * @param onPremiseIotSensorName Name of the on-premise IoT sensor. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return on-premise IoT sensor. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + OnPremiseIotSensorInner createOrUpdate(String onPremiseIotSensorName); + + /** + * Create or update on-premise IoT sensor. + * + * @param onPremiseIotSensorName Name of the on-premise IoT sensor. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return on-premise IoT sensor. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse(String onPremiseIotSensorName, Context context); + + /** + * Delete on-premise IoT sensor. + * + * @param onPremiseIotSensorName Name of the on-premise IoT sensor. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String onPremiseIotSensorName); + + /** + * Delete on-premise IoT sensor. + * + * @param onPremiseIotSensorName Name of the on-premise IoT sensor. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String onPremiseIotSensorName, Context context); + + /** + * Download sensor activation file. + * + * @param onPremiseIotSensorName Name of the on-premise IoT sensor. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + InputStream downloadActivation(String onPremiseIotSensorName); + + /** + * Download sensor activation file. + * + * @param onPremiseIotSensorName Name of the on-premise IoT sensor. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + StreamResponse downloadActivationWithResponse(String onPremiseIotSensorName, Context context); + + /** + * Download file for reset password of the sensor. + * + * @param onPremiseIotSensorName Name of the on-premise IoT sensor. + * @param body Input for reset password. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + InputStream downloadResetPassword(String onPremiseIotSensorName, ResetPasswordInput body); + + /** + * Download file for reset password of the sensor. + * + * @param onPremiseIotSensorName Name of the on-premise IoT sensor. + * @param body Input for reset password. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + StreamResponse downloadResetPasswordWithResponse( + String onPremiseIotSensorName, ResetPasswordInput body, Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/OperationsClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/OperationsClient.java new file mode 100644 index 000000000000..329a3db4ed77 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/OperationsClient.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.OperationInner; + +/** An instance of this class provides access to all the operations defined in OperationsClient. */ +public interface OperationsClient { + /** + * Exposes all available operations for discovery purposes. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of possible operations for Microsoft. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Exposes all available operations for discovery purposes. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of possible operations for Microsoft. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/PricingsClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/PricingsClient.java new file mode 100644 index 000000000000..0e10a8641ae3 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/PricingsClient.java @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.PricingInner; +import com.azure.resourcemanager.security.fluent.models.PricingListInner; + +/** An instance of this class provides access to all the operations defined in PricingsClient. */ +public interface PricingsClient { + /** + * Lists Security Center pricing configurations in the subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of pricing configurations response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PricingListInner list(); + + /** + * Lists Security Center pricing configurations in the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of pricing configurations response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listWithResponse(Context context); + + /** + * Gets a provided Security Center pricing configuration in the subscription. + * + * @param pricingName name of the pricing configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a provided Security Center pricing configuration in the subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PricingInner get(String pricingName); + + /** + * Gets a provided Security Center pricing configuration in the subscription. + * + * @param pricingName name of the pricing configuration. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a provided Security Center pricing configuration in the subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String pricingName, Context context); + + /** + * Updates a provided Security Center pricing configuration in the subscription. + * + * @param pricingName name of the pricing configuration. + * @param pricing Pricing object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure Security Center is provided in two pricing tiers: free and standard, with the standard tier + * available with a trial period. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PricingInner update(String pricingName, PricingInner pricing); + + /** + * Updates a provided Security Center pricing configuration in the subscription. + * + * @param pricingName name of the pricing configuration. + * @param pricing Pricing object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure Security Center is provided in two pricing tiers: free and standard, with the standard tier + * available with a trial period. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse(String pricingName, PricingInner pricing, Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/RegulatoryComplianceAssessmentsClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/RegulatoryComplianceAssessmentsClient.java new file mode 100644 index 000000000000..1100f050a32d --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/RegulatoryComplianceAssessmentsClient.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.RegulatoryComplianceAssessmentInner; + +/** An instance of this class provides access to all the operations defined in RegulatoryComplianceAssessmentsClient. */ +public interface RegulatoryComplianceAssessmentsClient { + /** + * Details and state of assessments mapped to selected regulatory compliance control. + * + * @param regulatoryComplianceStandardName Name of the regulatory compliance standard object. + * @param regulatoryComplianceControlName Name of the regulatory compliance control object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of regulatory compliance assessment response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String regulatoryComplianceStandardName, String regulatoryComplianceControlName); + + /** + * Details and state of assessments mapped to selected regulatory compliance control. + * + * @param regulatoryComplianceStandardName Name of the regulatory compliance standard object. + * @param regulatoryComplianceControlName Name of the regulatory compliance control object. + * @param filter OData filter. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of regulatory compliance assessment response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String regulatoryComplianceStandardName, + String regulatoryComplianceControlName, + String filter, + Context context); + + /** + * Supported regulatory compliance details and state for selected assessment. + * + * @param regulatoryComplianceStandardName Name of the regulatory compliance standard object. + * @param regulatoryComplianceControlName Name of the regulatory compliance control object. + * @param regulatoryComplianceAssessmentName Name of the regulatory compliance assessment object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return regulatory compliance assessment details and state. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RegulatoryComplianceAssessmentInner get( + String regulatoryComplianceStandardName, + String regulatoryComplianceControlName, + String regulatoryComplianceAssessmentName); + + /** + * Supported regulatory compliance details and state for selected assessment. + * + * @param regulatoryComplianceStandardName Name of the regulatory compliance standard object. + * @param regulatoryComplianceControlName Name of the regulatory compliance control object. + * @param regulatoryComplianceAssessmentName Name of the regulatory compliance assessment object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return regulatory compliance assessment details and state. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String regulatoryComplianceStandardName, + String regulatoryComplianceControlName, + String regulatoryComplianceAssessmentName, + Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/RegulatoryComplianceControlsClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/RegulatoryComplianceControlsClient.java new file mode 100644 index 000000000000..e840c3d5f320 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/RegulatoryComplianceControlsClient.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.RegulatoryComplianceControlInner; + +/** An instance of this class provides access to all the operations defined in RegulatoryComplianceControlsClient. */ +public interface RegulatoryComplianceControlsClient { + /** + * All supported regulatory compliance controls details and state for selected standard. + * + * @param regulatoryComplianceStandardName Name of the regulatory compliance standard object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of regulatory compliance controls response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String regulatoryComplianceStandardName); + + /** + * All supported regulatory compliance controls details and state for selected standard. + * + * @param regulatoryComplianceStandardName Name of the regulatory compliance standard object. + * @param filter OData filter. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of regulatory compliance controls response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String regulatoryComplianceStandardName, String filter, Context context); + + /** + * Selected regulatory compliance control details and state. + * + * @param regulatoryComplianceStandardName Name of the regulatory compliance standard object. + * @param regulatoryComplianceControlName Name of the regulatory compliance control object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return regulatory compliance control details and state. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RegulatoryComplianceControlInner get( + String regulatoryComplianceStandardName, String regulatoryComplianceControlName); + + /** + * Selected regulatory compliance control details and state. + * + * @param regulatoryComplianceStandardName Name of the regulatory compliance standard object. + * @param regulatoryComplianceControlName Name of the regulatory compliance control object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return regulatory compliance control details and state. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String regulatoryComplianceStandardName, String regulatoryComplianceControlName, Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/RegulatoryComplianceStandardsClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/RegulatoryComplianceStandardsClient.java new file mode 100644 index 000000000000..9bbdaab5f7ae --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/RegulatoryComplianceStandardsClient.java @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.RegulatoryComplianceStandardInner; + +/** An instance of this class provides access to all the operations defined in RegulatoryComplianceStandardsClient. */ +public interface RegulatoryComplianceStandardsClient { + /** + * Supported regulatory compliance standards details and state. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of regulatory compliance standards response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Supported regulatory compliance standards details and state. + * + * @param filter OData filter. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of regulatory compliance standards response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String filter, Context context); + + /** + * Supported regulatory compliance details state for selected standard. + * + * @param regulatoryComplianceStandardName Name of the regulatory compliance standard object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return regulatory compliance standard details and state. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RegulatoryComplianceStandardInner get(String regulatoryComplianceStandardName); + + /** + * Supported regulatory compliance details state for selected standard. + * + * @param regulatoryComplianceStandardName Name of the regulatory compliance standard object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return regulatory compliance standard details and state. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String regulatoryComplianceStandardName, Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/SecureScoreControlDefinitionsClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/SecureScoreControlDefinitionsClient.java new file mode 100644 index 000000000000..0a5e4ce88eaa --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/SecureScoreControlDefinitionsClient.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.SecureScoreControlDefinitionItemInner; + +/** An instance of this class provides access to all the operations defined in SecureScoreControlDefinitionsClient. */ +public interface SecureScoreControlDefinitionsClient { + /** + * List the available security controls, their assessments, and the max score. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security controls definition. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List the available security controls, their assessments, and the max score. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security controls definition. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * For a specified subscription, list the available security controls, their assessments, and the max score. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security controls definition. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listBySubscription(); + + /** + * For a specified subscription, list the available security controls, their assessments, and the max score. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security controls definition. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listBySubscription(Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/SecureScoreControlsClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/SecureScoreControlsClient.java new file mode 100644 index 000000000000..586b17c1b0ff --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/SecureScoreControlsClient.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.SecureScoreControlDetailsInner; +import com.azure.resourcemanager.security.models.ExpandControlsEnum; + +/** An instance of this class provides access to all the operations defined in SecureScoreControlsClient. */ +public interface SecureScoreControlsClient { + /** + * Get all security controls for a specific initiative within a scope. + * + * @param secureScoreName The initiative name. For the ASC Default initiative, use 'ascScore' as in the sample + * request below. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all security controls for a specific initiative within a scope. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listBySecureScore(String secureScoreName); + + /** + * Get all security controls for a specific initiative within a scope. + * + * @param secureScoreName The initiative name. For the ASC Default initiative, use 'ascScore' as in the sample + * request below. + * @param expand OData expand. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all security controls for a specific initiative within a scope. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listBySecureScore( + String secureScoreName, ExpandControlsEnum expand, Context context); + + /** + * Get all security controls within a scope. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all security controls within a scope. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Get all security controls within a scope. + * + * @param expand OData expand. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all security controls within a scope. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(ExpandControlsEnum expand, Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/SecureScoresClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/SecureScoresClient.java new file mode 100644 index 000000000000..fb31886fd226 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/SecureScoresClient.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.SecureScoreItemInner; + +/** An instance of this class provides access to all the operations defined in SecureScoresClient. */ +public interface SecureScoresClient { + /** + * List secure scores for all your Security Center initiatives within your current scope. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of secure scores. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List secure scores for all your Security Center initiatives within your current scope. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of secure scores. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * Get secure score for a specific Security Center initiative within your current scope. For the ASC Default + * initiative, use 'ascScore'. + * + * @param secureScoreName The initiative name. For the ASC Default initiative, use 'ascScore' as in the sample + * request below. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return secure score for a specific Security Center initiative within your current scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SecureScoreItemInner get(String secureScoreName); + + /** + * Get secure score for a specific Security Center initiative within your current scope. For the ASC Default + * initiative, use 'ascScore'. + * + * @param secureScoreName The initiative name. For the ASC Default initiative, use 'ascScore' as in the sample + * request below. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return secure score for a specific Security Center initiative within your current scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String secureScoreName, Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/SecurityCenter.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/SecurityCenter.java new file mode 100644 index 000000000000..ed8d21449d3a --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/SecurityCenter.java @@ -0,0 +1,431 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** The interface for SecurityCenter class. */ +public interface SecurityCenter { + /** + * Gets Azure subscription ID. + * + * @return the subscriptionId value. + */ + String getSubscriptionId(); + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + String getEndpoint(); + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + HttpPipeline getHttpPipeline(); + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + Duration getDefaultPollInterval(); + + /** + * Gets the ComplianceResultsClient object to access its operations. + * + * @return the ComplianceResultsClient object. + */ + ComplianceResultsClient getComplianceResults(); + + /** + * Gets the PricingsClient object to access its operations. + * + * @return the PricingsClient object. + */ + PricingsClient getPricings(); + + /** + * Gets the AdvancedThreatProtectionsClient object to access its operations. + * + * @return the AdvancedThreatProtectionsClient object. + */ + AdvancedThreatProtectionsClient getAdvancedThreatProtections(); + + /** + * Gets the DeviceSecurityGroupsClient object to access its operations. + * + * @return the DeviceSecurityGroupsClient object. + */ + DeviceSecurityGroupsClient getDeviceSecurityGroups(); + + /** + * Gets the IotSecuritySolutionsClient object to access its operations. + * + * @return the IotSecuritySolutionsClient object. + */ + IotSecuritySolutionsClient getIotSecuritySolutions(); + + /** + * Gets the IotSecuritySolutionAnalyticsClient object to access its operations. + * + * @return the IotSecuritySolutionAnalyticsClient object. + */ + IotSecuritySolutionAnalyticsClient getIotSecuritySolutionAnalytics(); + + /** + * Gets the IotSecuritySolutionsAnalyticsAggregatedAlertsClient object to access its operations. + * + * @return the IotSecuritySolutionsAnalyticsAggregatedAlertsClient object. + */ + IotSecuritySolutionsAnalyticsAggregatedAlertsClient getIotSecuritySolutionsAnalyticsAggregatedAlerts(); + + /** + * Gets the IotSecuritySolutionsAnalyticsRecommendationsClient object to access its operations. + * + * @return the IotSecuritySolutionsAnalyticsRecommendationsClient object. + */ + IotSecuritySolutionsAnalyticsRecommendationsClient getIotSecuritySolutionsAnalyticsRecommendations(); + + /** + * Gets the LocationsClient object to access its operations. + * + * @return the LocationsClient object. + */ + LocationsClient getLocations(); + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + OperationsClient getOperations(); + + /** + * Gets the TasksClient object to access its operations. + * + * @return the TasksClient object. + */ + TasksClient getTasks(); + + /** + * Gets the AutoProvisioningSettingsClient object to access its operations. + * + * @return the AutoProvisioningSettingsClient object. + */ + AutoProvisioningSettingsClient getAutoProvisioningSettings(); + + /** + * Gets the CompliancesClient object to access its operations. + * + * @return the CompliancesClient object. + */ + CompliancesClient getCompliances(); + + /** + * Gets the InformationProtectionPoliciesClient object to access its operations. + * + * @return the InformationProtectionPoliciesClient object. + */ + InformationProtectionPoliciesClient getInformationProtectionPolicies(); + + /** + * Gets the SecurityContactsClient object to access its operations. + * + * @return the SecurityContactsClient object. + */ + SecurityContactsClient getSecurityContacts(); + + /** + * Gets the WorkspaceSettingsClient object to access its operations. + * + * @return the WorkspaceSettingsClient object. + */ + WorkspaceSettingsClient getWorkspaceSettings(); + + /** + * Gets the RegulatoryComplianceStandardsClient object to access its operations. + * + * @return the RegulatoryComplianceStandardsClient object. + */ + RegulatoryComplianceStandardsClient getRegulatoryComplianceStandards(); + + /** + * Gets the RegulatoryComplianceControlsClient object to access its operations. + * + * @return the RegulatoryComplianceControlsClient object. + */ + RegulatoryComplianceControlsClient getRegulatoryComplianceControls(); + + /** + * Gets the RegulatoryComplianceAssessmentsClient object to access its operations. + * + * @return the RegulatoryComplianceAssessmentsClient object. + */ + RegulatoryComplianceAssessmentsClient getRegulatoryComplianceAssessments(); + + /** + * Gets the SubAssessmentsClient object to access its operations. + * + * @return the SubAssessmentsClient object. + */ + SubAssessmentsClient getSubAssessments(); + + /** + * Gets the AutomationsClient object to access its operations. + * + * @return the AutomationsClient object. + */ + AutomationsClient getAutomations(); + + /** + * Gets the AlertsSuppressionRulesClient object to access its operations. + * + * @return the AlertsSuppressionRulesClient object. + */ + AlertsSuppressionRulesClient getAlertsSuppressionRules(); + + /** + * Gets the ServerVulnerabilityAssessmentsClient object to access its operations. + * + * @return the ServerVulnerabilityAssessmentsClient object. + */ + ServerVulnerabilityAssessmentsClient getServerVulnerabilityAssessments(); + + /** + * Gets the AssessmentsMetadatasClient object to access its operations. + * + * @return the AssessmentsMetadatasClient object. + */ + AssessmentsMetadatasClient getAssessmentsMetadatas(); + + /** + * Gets the AssessmentsClient object to access its operations. + * + * @return the AssessmentsClient object. + */ + AssessmentsClient getAssessments(); + + /** + * Gets the AdaptiveApplicationControlsClient object to access its operations. + * + * @return the AdaptiveApplicationControlsClient object. + */ + AdaptiveApplicationControlsClient getAdaptiveApplicationControls(); + + /** + * Gets the AdaptiveNetworkHardeningsClient object to access its operations. + * + * @return the AdaptiveNetworkHardeningsClient object. + */ + AdaptiveNetworkHardeningsClient getAdaptiveNetworkHardenings(); + + /** + * Gets the AllowedConnectionsClient object to access its operations. + * + * @return the AllowedConnectionsClient object. + */ + AllowedConnectionsClient getAllowedConnections(); + + /** + * Gets the TopologiesClient object to access its operations. + * + * @return the TopologiesClient object. + */ + TopologiesClient getTopologies(); + + /** + * Gets the JitNetworkAccessPoliciesClient object to access its operations. + * + * @return the JitNetworkAccessPoliciesClient object. + */ + JitNetworkAccessPoliciesClient getJitNetworkAccessPolicies(); + + /** + * Gets the DiscoveredSecuritySolutionsClient object to access its operations. + * + * @return the DiscoveredSecuritySolutionsClient object. + */ + DiscoveredSecuritySolutionsClient getDiscoveredSecuritySolutions(); + + /** + * Gets the SecuritySolutionsReferenceDatasClient object to access its operations. + * + * @return the SecuritySolutionsReferenceDatasClient object. + */ + SecuritySolutionsReferenceDatasClient getSecuritySolutionsReferenceDatas(); + + /** + * Gets the ExternalSecuritySolutionsClient object to access its operations. + * + * @return the ExternalSecuritySolutionsClient object. + */ + ExternalSecuritySolutionsClient getExternalSecuritySolutions(); + + /** + * Gets the SecureScoresClient object to access its operations. + * + * @return the SecureScoresClient object. + */ + SecureScoresClient getSecureScores(); + + /** + * Gets the SecureScoreControlsClient object to access its operations. + * + * @return the SecureScoreControlsClient object. + */ + SecureScoreControlsClient getSecureScoreControls(); + + /** + * Gets the SecureScoreControlDefinitionsClient object to access its operations. + * + * @return the SecureScoreControlDefinitionsClient object. + */ + SecureScoreControlDefinitionsClient getSecureScoreControlDefinitions(); + + /** + * Gets the SecuritySolutionsClient object to access its operations. + * + * @return the SecuritySolutionsClient object. + */ + SecuritySolutionsClient getSecuritySolutions(); + + /** + * Gets the ConnectorsClient object to access its operations. + * + * @return the ConnectorsClient object. + */ + ConnectorsClient getConnectors(); + + /** + * Gets the SqlVulnerabilityAssessmentScansClient object to access its operations. + * + * @return the SqlVulnerabilityAssessmentScansClient object. + */ + SqlVulnerabilityAssessmentScansClient getSqlVulnerabilityAssessmentScans(); + + /** + * Gets the SqlVulnerabilityAssessmentScanResultsClient object to access its operations. + * + * @return the SqlVulnerabilityAssessmentScanResultsClient object. + */ + SqlVulnerabilityAssessmentScanResultsClient getSqlVulnerabilityAssessmentScanResults(); + + /** + * Gets the SqlVulnerabilityAssessmentBaselineRulesClient object to access its operations. + * + * @return the SqlVulnerabilityAssessmentBaselineRulesClient object. + */ + SqlVulnerabilityAssessmentBaselineRulesClient getSqlVulnerabilityAssessmentBaselineRules(); + + /** + * Gets the IotDefenderSettingsClient object to access its operations. + * + * @return the IotDefenderSettingsClient object. + */ + IotDefenderSettingsClient getIotDefenderSettings(); + + /** + * Gets the IotSensorsClient object to access its operations. + * + * @return the IotSensorsClient object. + */ + IotSensorsClient getIotSensors(); + + /** + * Gets the DevicesForSubscriptionsClient object to access its operations. + * + * @return the DevicesForSubscriptionsClient object. + */ + DevicesForSubscriptionsClient getDevicesForSubscriptions(); + + /** + * Gets the DevicesForHubsClient object to access its operations. + * + * @return the DevicesForHubsClient object. + */ + DevicesForHubsClient getDevicesForHubs(); + + /** + * Gets the DevicesClient object to access its operations. + * + * @return the DevicesClient object. + */ + DevicesClient getDevices(); + + /** + * Gets the OnPremiseIotSensorsClient object to access its operations. + * + * @return the OnPremiseIotSensorsClient object. + */ + OnPremiseIotSensorsClient getOnPremiseIotSensors(); + + /** + * Gets the IotSitesClient object to access its operations. + * + * @return the IotSitesClient object. + */ + IotSitesClient getIotSites(); + + /** + * Gets the IotAlertsClient object to access its operations. + * + * @return the IotAlertsClient object. + */ + IotAlertsClient getIotAlerts(); + + /** + * Gets the IotAlertTypesClient object to access its operations. + * + * @return the IotAlertTypesClient object. + */ + IotAlertTypesClient getIotAlertTypes(); + + /** + * Gets the IotRecommendationsClient object to access its operations. + * + * @return the IotRecommendationsClient object. + */ + IotRecommendationsClient getIotRecommendations(); + + /** + * Gets the IotRecommendationTypesClient object to access its operations. + * + * @return the IotRecommendationTypesClient object. + */ + IotRecommendationTypesClient getIotRecommendationTypes(); + + /** + * Gets the AlertsClient object to access its operations. + * + * @return the AlertsClient object. + */ + AlertsClient getAlerts(); + + /** + * Gets the SettingsClient object to access its operations. + * + * @return the SettingsClient object. + */ + SettingsClient getSettings(); + + /** + * Gets the IngestionSettingsClient object to access its operations. + * + * @return the IngestionSettingsClient object. + */ + IngestionSettingsClient getIngestionSettings(); + + /** + * Gets the SoftwareInventoriesClient object to access its operations. + * + * @return the SoftwareInventoriesClient object. + */ + SoftwareInventoriesClient getSoftwareInventories(); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/SecurityContactsClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/SecurityContactsClient.java new file mode 100644 index 000000000000..cb1929f2c13c --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/SecurityContactsClient.java @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.SecurityContactInner; + +/** An instance of this class provides access to all the operations defined in SecurityContactsClient. */ +public interface SecurityContactsClient { + /** + * Security contact configurations for the subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security contacts response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Security contact configurations for the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security contacts response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * Security contact configurations for the subscription. + * + * @param securityContactName Name of the security contact object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return contact details for security issues. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SecurityContactInner get(String securityContactName); + + /** + * Security contact configurations for the subscription. + * + * @param securityContactName Name of the security contact object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return contact details for security issues. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String securityContactName, Context context); + + /** + * Security contact configurations for the subscription. + * + * @param securityContactName Name of the security contact object. + * @param securityContact Security contact object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return contact details for security issues. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SecurityContactInner create(String securityContactName, SecurityContactInner securityContact); + + /** + * Security contact configurations for the subscription. + * + * @param securityContactName Name of the security contact object. + * @param securityContact Security contact object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return contact details for security issues. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createWithResponse( + String securityContactName, SecurityContactInner securityContact, Context context); + + /** + * Security contact configurations for the subscription. + * + * @param securityContactName Name of the security contact object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String securityContactName); + + /** + * Security contact configurations for the subscription. + * + * @param securityContactName Name of the security contact object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String securityContactName, Context context); + + /** + * Security contact configurations for the subscription. + * + * @param securityContactName Name of the security contact object. + * @param securityContact Security contact object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return contact details for security issues. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SecurityContactInner update(String securityContactName, SecurityContactInner securityContact); + + /** + * Security contact configurations for the subscription. + * + * @param securityContactName Name of the security contact object. + * @param securityContact Security contact object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return contact details for security issues. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String securityContactName, SecurityContactInner securityContact, Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/SecuritySolutionsClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/SecuritySolutionsClient.java new file mode 100644 index 000000000000..fe9535a7bf5a --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/SecuritySolutionsClient.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.SecuritySolutionInner; + +/** An instance of this class provides access to all the operations defined in SecuritySolutionsClient. */ +public interface SecuritySolutionsClient { + /** + * Gets a list of Security Solutions for the subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Security Solutions for the subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Gets a list of Security Solutions for the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Security Solutions for the subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * Gets a specific Security Solution. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param securitySolutionName Name of security solution. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a specific Security Solution. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SecuritySolutionInner get(String resourceGroupName, String ascLocation, String securitySolutionName); + + /** + * Gets a specific Security Solution. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param securitySolutionName Name of security solution. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a specific Security Solution. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String ascLocation, String securitySolutionName, Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/SecuritySolutionsReferenceDatasClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/SecuritySolutionsReferenceDatasClient.java new file mode 100644 index 000000000000..cb48242e29bb --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/SecuritySolutionsReferenceDatasClient.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.SecuritySolutionsReferenceDataListInner; + +/** An instance of this class provides access to all the operations defined in SecuritySolutionsReferenceDatasClient. */ +public interface SecuritySolutionsReferenceDatasClient { + /** + * Gets a list of all supported Security Solutions for the subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all supported Security Solutions for the subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SecuritySolutionsReferenceDataListInner list(); + + /** + * Gets a list of all supported Security Solutions for the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all supported Security Solutions for the subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listWithResponse(Context context); + + /** + * Gets list of all supported Security Solutions for subscription and location. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of all supported Security Solutions for subscription and location. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SecuritySolutionsReferenceDataListInner listByHomeRegion(String ascLocation); + + /** + * Gets list of all supported Security Solutions for subscription and location. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of all supported Security Solutions for subscription and location. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listByHomeRegionWithResponse(String ascLocation, Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/ServerVulnerabilityAssessmentsClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/ServerVulnerabilityAssessmentsClient.java new file mode 100644 index 000000000000..6725b6c2d2b1 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/ServerVulnerabilityAssessmentsClient.java @@ -0,0 +1,191 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.security.fluent.models.ServerVulnerabilityAssessmentInner; +import com.azure.resourcemanager.security.fluent.models.ServerVulnerabilityAssessmentsListInner; + +/** An instance of this class provides access to all the operations defined in ServerVulnerabilityAssessmentsClient. */ +public interface ServerVulnerabilityAssessmentsClient { + /** + * Gets a list of server vulnerability assessment onboarding statuses on a given resource. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server vulnerability assessment onboarding statuses on a given resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerVulnerabilityAssessmentsListInner listByExtendedResource( + String resourceGroupName, String resourceNamespace, String resourceType, String resourceName); + + /** + * Gets a list of server vulnerability assessment onboarding statuses on a given resource. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server vulnerability assessment onboarding statuses on a given resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listByExtendedResourceWithResponse( + String resourceGroupName, String resourceNamespace, String resourceType, String resourceName, Context context); + + /** + * Gets a server vulnerability assessment onboarding statuses on a given resource. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server vulnerability assessment onboarding statuses on a given resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerVulnerabilityAssessmentInner get( + String resourceGroupName, String resourceNamespace, String resourceType, String resourceName); + + /** + * Gets a server vulnerability assessment onboarding statuses on a given resource. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server vulnerability assessment onboarding statuses on a given resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String resourceNamespace, String resourceType, String resourceName, Context context); + + /** + * Creating a server vulnerability assessment on a resource, which will onboard a resource for having a + * vulnerability assessment on it. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the server vulnerability assessment details on a resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerVulnerabilityAssessmentInner createOrUpdate( + String resourceGroupName, String resourceNamespace, String resourceType, String resourceName); + + /** + * Creating a server vulnerability assessment on a resource, which will onboard a resource for having a + * vulnerability assessment on it. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the server vulnerability assessment details on a resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, String resourceNamespace, String resourceType, String resourceName, Context context); + + /** + * Removing server vulnerability assessment from a resource. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete( + String resourceGroupName, String resourceNamespace, String resourceType, String resourceName); + + /** + * Removing server vulnerability assessment from a resource. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete( + String resourceGroupName, String resourceNamespace, String resourceType, String resourceName, Context context); + + /** + * Removing server vulnerability assessment from a resource. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String resourceNamespace, String resourceType, String resourceName); + + /** + * Removing server vulnerability assessment from a resource. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete( + String resourceGroupName, String resourceNamespace, String resourceType, String resourceName, Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/SettingsClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/SettingsClient.java new file mode 100644 index 000000000000..54cae08ff3a5 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/SettingsClient.java @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.SettingInner; +import com.azure.resourcemanager.security.models.SettingsSettingName; + +/** An instance of this class provides access to all the operations defined in SettingsClient. */ +public interface SettingsClient { + /** + * Settings about different configurations in security center. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return subscription settings list. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Settings about different configurations in security center. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return subscription settings list. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * Settings of different configurations in security center. + * + * @param settingName The name of the setting. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the kind of the security setting. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SettingInner get(SettingsSettingName settingName); + + /** + * Settings of different configurations in security center. + * + * @param settingName The name of the setting. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the kind of the security setting. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(SettingsSettingName settingName, Context context); + + /** + * updating settings about different configurations in security center. + * + * @param settingName The name of the setting. + * @param setting Setting object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the kind of the security setting. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SettingInner update(SettingsSettingName settingName, SettingInner setting); + + /** + * updating settings about different configurations in security center. + * + * @param settingName The name of the setting. + * @param setting Setting object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the kind of the security setting. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse(SettingsSettingName settingName, SettingInner setting, Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/SoftwareInventoriesClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/SoftwareInventoriesClient.java new file mode 100644 index 000000000000..cc9f1ab364f0 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/SoftwareInventoriesClient.java @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.SoftwareInner; + +/** An instance of this class provides access to all the operations defined in SoftwareInventoriesClient. */ +public interface SoftwareInventoriesClient { + /** + * Gets the software inventory of the virtual machine. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param resourceNamespace The namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the software inventory of the virtual machine. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByExtendedResource( + String resourceGroupName, String resourceNamespace, String resourceType, String resourceName); + + /** + * Gets the software inventory of the virtual machine. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param resourceNamespace The namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the software inventory of the virtual machine. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByExtendedResource( + String resourceGroupName, String resourceNamespace, String resourceType, String resourceName, Context context); + + /** + * Gets the software inventory of all virtual machines in the subscriptions. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the software inventory of all virtual machines in the subscriptions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Gets the software inventory of all virtual machines in the subscriptions. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the software inventory of all virtual machines in the subscriptions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * Gets a single software data of the virtual machine. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param resourceNamespace The namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @param softwareName Name of the installed software. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a single software data of the virtual machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SoftwareInner get( + String resourceGroupName, + String resourceNamespace, + String resourceType, + String resourceName, + String softwareName); + + /** + * Gets a single software data of the virtual machine. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param resourceNamespace The namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @param softwareName Name of the installed software. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a single software data of the virtual machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String resourceNamespace, + String resourceType, + String resourceName, + String softwareName, + Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/SqlVulnerabilityAssessmentBaselineRulesClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/SqlVulnerabilityAssessmentBaselineRulesClient.java new file mode 100644 index 000000000000..63c78c504c3d --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/SqlVulnerabilityAssessmentBaselineRulesClient.java @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.RuleResultsInner; +import com.azure.resourcemanager.security.fluent.models.RulesResultsInner; +import com.azure.resourcemanager.security.models.RuleResultsInput; +import com.azure.resourcemanager.security.models.RulesResultsInput; + +/** + * An instance of this class provides access to all the operations defined in + * SqlVulnerabilityAssessmentBaselineRulesClient. + */ +public interface SqlVulnerabilityAssessmentBaselineRulesClient { + /** + * Creates a Baseline for a rule in a database. Will overwrite any previously existing results. + * + * @param ruleId The rule Id. + * @param workspaceId The workspace Id. + * @param resourceId The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return rule results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RuleResultsInner createOrUpdate(String ruleId, String workspaceId, String resourceId); + + /** + * Creates a Baseline for a rule in a database. Will overwrite any previously existing results. + * + * @param ruleId The rule Id. + * @param workspaceId The workspace Id. + * @param resourceId The identifier of the resource. + * @param body The baseline results for this rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return rule results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String ruleId, String workspaceId, String resourceId, RuleResultsInput body, Context context); + + /** + * Gets the results for a given rule in the Baseline. + * + * @param ruleId The rule Id. + * @param workspaceId The workspace Id. + * @param resourceId The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the results for a given rule in the Baseline. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RuleResultsInner get(String ruleId, String workspaceId, String resourceId); + + /** + * Gets the results for a given rule in the Baseline. + * + * @param ruleId The rule Id. + * @param workspaceId The workspace Id. + * @param resourceId The identifier of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the results for a given rule in the Baseline. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String ruleId, String workspaceId, String resourceId, Context context); + + /** + * Deletes a rule from the Baseline of a given database. + * + * @param ruleId The rule Id. + * @param workspaceId The workspace Id. + * @param resourceId The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String ruleId, String workspaceId, String resourceId); + + /** + * Deletes a rule from the Baseline of a given database. + * + * @param ruleId The rule Id. + * @param workspaceId The workspace Id. + * @param resourceId The identifier of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String ruleId, String workspaceId, String resourceId, Context context); + + /** + * Gets the results for all rules in the Baseline. + * + * @param workspaceId The workspace Id. + * @param resourceId The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the results for all rules in the Baseline. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RulesResultsInner list(String workspaceId, String resourceId); + + /** + * Gets the results for all rules in the Baseline. + * + * @param workspaceId The workspace Id. + * @param resourceId The identifier of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the results for all rules in the Baseline. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listWithResponse(String workspaceId, String resourceId, Context context); + + /** + * Add a list of baseline rules. Will overwrite any previously existing results (for all rules). + * + * @param workspaceId The workspace Id. + * @param resourceId The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of rules results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RulesResultsInner add(String workspaceId, String resourceId); + + /** + * Add a list of baseline rules. Will overwrite any previously existing results (for all rules). + * + * @param workspaceId The workspace Id. + * @param resourceId The identifier of the resource. + * @param body The baseline rules. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of rules results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response addWithResponse( + String workspaceId, String resourceId, RulesResultsInput body, Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/SqlVulnerabilityAssessmentScanResultsClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/SqlVulnerabilityAssessmentScanResultsClient.java new file mode 100644 index 000000000000..38060ada1168 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/SqlVulnerabilityAssessmentScanResultsClient.java @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.ScanResultInner; +import com.azure.resourcemanager.security.fluent.models.ScanResultsInner; + +/** + * An instance of this class provides access to all the operations defined in + * SqlVulnerabilityAssessmentScanResultsClient. + */ +public interface SqlVulnerabilityAssessmentScanResultsClient { + /** + * Gets the scan results of a single rule in a scan record. + * + * @param scanId The scan Id. Type 'latest' to get the scan results for the latest scan. + * @param scanResultId The rule Id of the results. + * @param workspaceId The workspace Id. + * @param resourceId The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the scan results of a single rule in a scan record. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ScanResultInner get(String scanId, String scanResultId, String workspaceId, String resourceId); + + /** + * Gets the scan results of a single rule in a scan record. + * + * @param scanId The scan Id. Type 'latest' to get the scan results for the latest scan. + * @param scanResultId The rule Id of the results. + * @param workspaceId The workspace Id. + * @param resourceId The identifier of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the scan results of a single rule in a scan record. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String scanId, String scanResultId, String workspaceId, String resourceId, Context context); + + /** + * Gets a list of scan results for a single scan record. + * + * @param scanId The scan Id. Type 'latest' to get the scan results for the latest scan. + * @param workspaceId The workspace Id. + * @param resourceId The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of scan results for a single scan record. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ScanResultsInner list(String scanId, String workspaceId, String resourceId); + + /** + * Gets a list of scan results for a single scan record. + * + * @param scanId The scan Id. Type 'latest' to get the scan results for the latest scan. + * @param workspaceId The workspace Id. + * @param resourceId The identifier of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of scan results for a single scan record. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listWithResponse(String scanId, String workspaceId, String resourceId, Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/SqlVulnerabilityAssessmentScansClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/SqlVulnerabilityAssessmentScansClient.java new file mode 100644 index 000000000000..a0fe8031cc17 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/SqlVulnerabilityAssessmentScansClient.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.ScanInner; +import com.azure.resourcemanager.security.fluent.models.ScansInner; + +/** An instance of this class provides access to all the operations defined in SqlVulnerabilityAssessmentScansClient. */ +public interface SqlVulnerabilityAssessmentScansClient { + /** + * Gets the scan details of a single scan record. + * + * @param scanId The scan Id. Type 'latest' to get the scan record for the latest scan. + * @param workspaceId The workspace Id. + * @param resourceId The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the scan details of a single scan record. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ScanInner get(String scanId, String workspaceId, String resourceId); + + /** + * Gets the scan details of a single scan record. + * + * @param scanId The scan Id. Type 'latest' to get the scan record for the latest scan. + * @param workspaceId The workspace Id. + * @param resourceId The identifier of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the scan details of a single scan record. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String scanId, String workspaceId, String resourceId, Context context); + + /** + * Gets a list of scan records. + * + * @param workspaceId The workspace Id. + * @param resourceId The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of scan records. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ScansInner list(String workspaceId, String resourceId); + + /** + * Gets a list of scan records. + * + * @param workspaceId The workspace Id. + * @param resourceId The identifier of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of scan records. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listWithResponse(String workspaceId, String resourceId, Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/SubAssessmentsClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/SubAssessmentsClient.java new file mode 100644 index 000000000000..ef2fafc457f1 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/SubAssessmentsClient.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.SecuritySubAssessmentInner; + +/** An instance of this class provides access to all the operations defined in SubAssessmentsClient. */ +public interface SubAssessmentsClient { + /** + * Get security sub-assessments on all your scanned resources inside a subscription scope. + * + * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return security sub-assessments on all your scanned resources inside a subscription scope. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listAll(String scope); + + /** + * Get security sub-assessments on all your scanned resources inside a subscription scope. + * + * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return security sub-assessments on all your scanned resources inside a subscription scope. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listAll(String scope, Context context); + + /** + * Get security sub-assessments on all your scanned resources inside a scope. + * + * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @param assessmentName The Assessment Key - Unique key for the assessment type. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return security sub-assessments on all your scanned resources inside a scope. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String scope, String assessmentName); + + /** + * Get security sub-assessments on all your scanned resources inside a scope. + * + * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @param assessmentName The Assessment Key - Unique key for the assessment type. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return security sub-assessments on all your scanned resources inside a scope. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String scope, String assessmentName, Context context); + + /** + * Get a security sub-assessment on your scanned resource. + * + * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @param assessmentName The Assessment Key - Unique key for the assessment type. + * @param subAssessmentName The Sub-Assessment Key - Unique key for the sub-assessment type. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a security sub-assessment on your scanned resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SecuritySubAssessmentInner get(String scope, String assessmentName, String subAssessmentName); + + /** + * Get a security sub-assessment on your scanned resource. + * + * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @param assessmentName The Assessment Key - Unique key for the assessment type. + * @param subAssessmentName The Sub-Assessment Key - Unique key for the sub-assessment type. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a security sub-assessment on your scanned resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String scope, String assessmentName, String subAssessmentName, Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/TasksClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/TasksClient.java new file mode 100644 index 000000000000..ba7689390426 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/TasksClient.java @@ -0,0 +1,236 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.SecurityTaskInner; +import com.azure.resourcemanager.security.models.TasksTaskUpdateActionType; + +/** An instance of this class provides access to all the operations defined in TasksClient. */ +public interface TasksClient { + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security task recommendations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param filter OData filter. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security task recommendations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String filter, Context context); + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security task recommendations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByHomeRegion(String ascLocation); + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param filter OData filter. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security task recommendations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByHomeRegion(String ascLocation, String filter, Context context); + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param taskName Name of the task object, will be a GUID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return security task that we recommend to do in order to strengthen security. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SecurityTaskInner getSubscriptionLevelTask(String ascLocation, String taskName); + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param taskName Name of the task object, will be a GUID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return security task that we recommend to do in order to strengthen security. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getSubscriptionLevelTaskWithResponse( + String ascLocation, String taskName, Context context); + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param taskName Name of the task object, will be a GUID. + * @param taskUpdateActionType Type of the action to do on the task. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void updateSubscriptionLevelTaskState( + String ascLocation, String taskName, TasksTaskUpdateActionType taskUpdateActionType); + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param taskName Name of the task object, will be a GUID. + * @param taskUpdateActionType Type of the action to do on the task. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateSubscriptionLevelTaskStateWithResponse( + String ascLocation, String taskName, TasksTaskUpdateActionType taskUpdateActionType, Context context); + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security task recommendations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, String ascLocation); + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param filter OData filter. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security task recommendations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup( + String resourceGroupName, String ascLocation, String filter, Context context); + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param taskName Name of the task object, will be a GUID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return security task that we recommend to do in order to strengthen security. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SecurityTaskInner getResourceGroupLevelTask(String resourceGroupName, String ascLocation, String taskName); + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param taskName Name of the task object, will be a GUID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return security task that we recommend to do in order to strengthen security. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getResourceGroupLevelTaskWithResponse( + String resourceGroupName, String ascLocation, String taskName, Context context); + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param taskName Name of the task object, will be a GUID. + * @param taskUpdateActionType Type of the action to do on the task. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void updateResourceGroupLevelTaskState( + String resourceGroupName, String ascLocation, String taskName, TasksTaskUpdateActionType taskUpdateActionType); + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param taskName Name of the task object, will be a GUID. + * @param taskUpdateActionType Type of the action to do on the task. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateResourceGroupLevelTaskStateWithResponse( + String resourceGroupName, + String ascLocation, + String taskName, + TasksTaskUpdateActionType taskUpdateActionType, + Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/TopologiesClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/TopologiesClient.java new file mode 100644 index 000000000000..d44a14f3c804 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/TopologiesClient.java @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.TopologyResourceInner; + +/** An instance of this class provides access to all the operations defined in TopologiesClient. */ +public interface TopologiesClient { + /** + * Gets a list that allows to build a topology view of a subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list that allows to build a topology view of a subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Gets a list that allows to build a topology view of a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list that allows to build a topology view of a subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * Gets a list that allows to build a topology view of a subscription and location. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list that allows to build a topology view of a subscription and location. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByHomeRegion(String ascLocation); + + /** + * Gets a list that allows to build a topology view of a subscription and location. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list that allows to build a topology view of a subscription and location. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByHomeRegion(String ascLocation, Context context); + + /** + * Gets a specific topology component. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param topologyResourceName Name of a topology resources collection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a specific topology component. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + TopologyResourceInner get(String resourceGroupName, String ascLocation, String topologyResourceName); + + /** + * Gets a specific topology component. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param topologyResourceName Name of a topology resources collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a specific topology component. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String ascLocation, String topologyResourceName, Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/WorkspaceSettingsClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/WorkspaceSettingsClient.java new file mode 100644 index 000000000000..224d6aa6585e --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/WorkspaceSettingsClient.java @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.WorkspaceSettingInner; + +/** An instance of this class provides access to all the operations defined in WorkspaceSettingsClient. */ +public interface WorkspaceSettingsClient { + /** + * Settings about where we should store your security data and logs. If the result is empty, it means that no + * custom-workspace configuration was set. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of workspace settings response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Settings about where we should store your security data and logs. If the result is empty, it means that no + * custom-workspace configuration was set. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of workspace settings response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * Settings about where we should store your security data and logs. If the result is empty, it means that no + * custom-workspace configuration was set. + * + * @param workspaceSettingName Name of the security setting. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return configures where to store the OMS agent data for workspaces under a scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + WorkspaceSettingInner get(String workspaceSettingName); + + /** + * Settings about where we should store your security data and logs. If the result is empty, it means that no + * custom-workspace configuration was set. + * + * @param workspaceSettingName Name of the security setting. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return configures where to store the OMS agent data for workspaces under a scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String workspaceSettingName, Context context); + + /** + * creating settings about where we should store your security data and logs. + * + * @param workspaceSettingName Name of the security setting. + * @param workspaceSetting Security data setting object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return configures where to store the OMS agent data for workspaces under a scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + WorkspaceSettingInner create(String workspaceSettingName, WorkspaceSettingInner workspaceSetting); + + /** + * creating settings about where we should store your security data and logs. + * + * @param workspaceSettingName Name of the security setting. + * @param workspaceSetting Security data setting object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return configures where to store the OMS agent data for workspaces under a scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createWithResponse( + String workspaceSettingName, WorkspaceSettingInner workspaceSetting, Context context); + + /** + * Settings about where we should store your security data and logs. + * + * @param workspaceSettingName Name of the security setting. + * @param workspaceSetting Security data setting object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return configures where to store the OMS agent data for workspaces under a scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + WorkspaceSettingInner update(String workspaceSettingName, WorkspaceSettingInner workspaceSetting); + + /** + * Settings about where we should store your security data and logs. + * + * @param workspaceSettingName Name of the security setting. + * @param workspaceSetting Security data setting object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return configures where to store the OMS agent data for workspaces under a scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String workspaceSettingName, WorkspaceSettingInner workspaceSetting, Context context); + + /** + * Deletes the custom workspace settings for this subscription. new VMs will report to the default workspace. + * + * @param workspaceSettingName Name of the security setting. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String workspaceSettingName); + + /** + * Deletes the custom workspace settings for this subscription. new VMs will report to the default workspace. + * + * @param workspaceSettingName Name of the security setting. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String workspaceSettingName, Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AdaptiveApplicationControlGroupInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AdaptiveApplicationControlGroupInner.java new file mode 100644 index 000000000000..63eb3290cc2e --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AdaptiveApplicationControlGroupInner.java @@ -0,0 +1,233 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.models.AdaptiveApplicationControlIssueSummary; +import com.azure.resourcemanager.security.models.ConfigurationStatus; +import com.azure.resourcemanager.security.models.EnforcementMode; +import com.azure.resourcemanager.security.models.PathRecommendation; +import com.azure.resourcemanager.security.models.ProtectionMode; +import com.azure.resourcemanager.security.models.RecommendationStatus; +import com.azure.resourcemanager.security.models.SourceSystem; +import com.azure.resourcemanager.security.models.VmRecommendation; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The AdaptiveApplicationControlGroup model. */ +@JsonFlatten +@Fluent +public class AdaptiveApplicationControlGroupInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AdaptiveApplicationControlGroupInner.class); + + /* + * The application control policy enforcement/protection mode of the + * machine group + */ + @JsonProperty(value = "properties.enforcementMode") + private EnforcementMode enforcementMode; + + /* + * The protection mode of the collection/file types. Exe/Msi/Script are + * used for Windows, Executable is used for Linux. + */ + @JsonProperty(value = "properties.protectionMode") + private ProtectionMode protectionMode; + + /* + * The configuration status of the machines group or machine or rule + */ + @JsonProperty(value = "properties.configurationStatus", access = JsonProperty.Access.WRITE_ONLY) + private ConfigurationStatus configurationStatus; + + /* + * The initial recommendation status of the machine group or machine + */ + @JsonProperty(value = "properties.recommendationStatus", access = JsonProperty.Access.WRITE_ONLY) + private RecommendationStatus recommendationStatus; + + /* + * The issues property. + */ + @JsonProperty(value = "properties.issues", access = JsonProperty.Access.WRITE_ONLY) + private List issues; + + /* + * The source type of the machine group + */ + @JsonProperty(value = "properties.sourceSystem", access = JsonProperty.Access.WRITE_ONLY) + private SourceSystem sourceSystem; + + /* + * The vmRecommendations property. + */ + @JsonProperty(value = "properties.vmRecommendations") + private List vmRecommendations; + + /* + * The pathRecommendations property. + */ + @JsonProperty(value = "properties.pathRecommendations") + private List pathRecommendations; + + /* + * Location where the resource is stored + */ + @JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY) + private String location; + + /** + * Get the enforcementMode property: The application control policy enforcement/protection mode of the machine + * group. + * + * @return the enforcementMode value. + */ + public EnforcementMode enforcementMode() { + return this.enforcementMode; + } + + /** + * Set the enforcementMode property: The application control policy enforcement/protection mode of the machine + * group. + * + * @param enforcementMode the enforcementMode value to set. + * @return the AdaptiveApplicationControlGroupInner object itself. + */ + public AdaptiveApplicationControlGroupInner withEnforcementMode(EnforcementMode enforcementMode) { + this.enforcementMode = enforcementMode; + return this; + } + + /** + * Get the protectionMode property: The protection mode of the collection/file types. Exe/Msi/Script are used for + * Windows, Executable is used for Linux. + * + * @return the protectionMode value. + */ + public ProtectionMode protectionMode() { + return this.protectionMode; + } + + /** + * Set the protectionMode property: The protection mode of the collection/file types. Exe/Msi/Script are used for + * Windows, Executable is used for Linux. + * + * @param protectionMode the protectionMode value to set. + * @return the AdaptiveApplicationControlGroupInner object itself. + */ + public AdaptiveApplicationControlGroupInner withProtectionMode(ProtectionMode protectionMode) { + this.protectionMode = protectionMode; + return this; + } + + /** + * Get the configurationStatus property: The configuration status of the machines group or machine or rule. + * + * @return the configurationStatus value. + */ + public ConfigurationStatus configurationStatus() { + return this.configurationStatus; + } + + /** + * Get the recommendationStatus property: The initial recommendation status of the machine group or machine. + * + * @return the recommendationStatus value. + */ + public RecommendationStatus recommendationStatus() { + return this.recommendationStatus; + } + + /** + * Get the issues property: The issues property. + * + * @return the issues value. + */ + public List issues() { + return this.issues; + } + + /** + * Get the sourceSystem property: The source type of the machine group. + * + * @return the sourceSystem value. + */ + public SourceSystem sourceSystem() { + return this.sourceSystem; + } + + /** + * Get the vmRecommendations property: The vmRecommendations property. + * + * @return the vmRecommendations value. + */ + public List vmRecommendations() { + return this.vmRecommendations; + } + + /** + * Set the vmRecommendations property: The vmRecommendations property. + * + * @param vmRecommendations the vmRecommendations value to set. + * @return the AdaptiveApplicationControlGroupInner object itself. + */ + public AdaptiveApplicationControlGroupInner withVmRecommendations(List vmRecommendations) { + this.vmRecommendations = vmRecommendations; + return this; + } + + /** + * Get the pathRecommendations property: The pathRecommendations property. + * + * @return the pathRecommendations value. + */ + public List pathRecommendations() { + return this.pathRecommendations; + } + + /** + * Set the pathRecommendations property: The pathRecommendations property. + * + * @param pathRecommendations the pathRecommendations value to set. + * @return the AdaptiveApplicationControlGroupInner object itself. + */ + public AdaptiveApplicationControlGroupInner withPathRecommendations(List pathRecommendations) { + this.pathRecommendations = pathRecommendations; + return this; + } + + /** + * Get the location property: Location where the resource is stored. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (protectionMode() != null) { + protectionMode().validate(); + } + if (issues() != null) { + issues().forEach(e -> e.validate()); + } + if (vmRecommendations() != null) { + vmRecommendations().forEach(e -> e.validate()); + } + if (pathRecommendations() != null) { + pathRecommendations().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AdaptiveApplicationControlGroupsInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AdaptiveApplicationControlGroupsInner.java new file mode 100644 index 000000000000..7ac4159c6932 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AdaptiveApplicationControlGroupsInner.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Represents a list of machine groups and set of rules that are recommended by Azure Security Center to be allowed. */ +@Fluent +public final class AdaptiveApplicationControlGroupsInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AdaptiveApplicationControlGroupsInner.class); + + /* + * The value property. + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the value property: The value property. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The value property. + * + * @param value the value value to set. + * @return the AdaptiveApplicationControlGroupsInner object itself. + */ + public AdaptiveApplicationControlGroupsInner withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AdaptiveNetworkHardeningInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AdaptiveNetworkHardeningInner.java new file mode 100644 index 000000000000..a8762ab58028 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AdaptiveNetworkHardeningInner.java @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.models.EffectiveNetworkSecurityGroups; +import com.azure.resourcemanager.security.models.Rule; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** The resource whose properties describes the Adaptive Network Hardening settings for some Azure resource. */ +@JsonFlatten +@Fluent +public class AdaptiveNetworkHardeningInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AdaptiveNetworkHardeningInner.class); + + /* + * The security rules which are recommended to be effective on the VM + */ + @JsonProperty(value = "properties.rules") + private List rules; + + /* + * The UTC time on which the rules were calculated + */ + @JsonProperty(value = "properties.rulesCalculationTime") + private OffsetDateTime rulesCalculationTime; + + /* + * The Network Security Groups effective on the network interfaces of the + * protected resource + */ + @JsonProperty(value = "properties.effectiveNetworkSecurityGroups") + private List effectiveNetworkSecurityGroups; + + /** + * Get the rules property: The security rules which are recommended to be effective on the VM. + * + * @return the rules value. + */ + public List rules() { + return this.rules; + } + + /** + * Set the rules property: The security rules which are recommended to be effective on the VM. + * + * @param rules the rules value to set. + * @return the AdaptiveNetworkHardeningInner object itself. + */ + public AdaptiveNetworkHardeningInner withRules(List rules) { + this.rules = rules; + return this; + } + + /** + * Get the rulesCalculationTime property: The UTC time on which the rules were calculated. + * + * @return the rulesCalculationTime value. + */ + public OffsetDateTime rulesCalculationTime() { + return this.rulesCalculationTime; + } + + /** + * Set the rulesCalculationTime property: The UTC time on which the rules were calculated. + * + * @param rulesCalculationTime the rulesCalculationTime value to set. + * @return the AdaptiveNetworkHardeningInner object itself. + */ + public AdaptiveNetworkHardeningInner withRulesCalculationTime(OffsetDateTime rulesCalculationTime) { + this.rulesCalculationTime = rulesCalculationTime; + return this; + } + + /** + * Get the effectiveNetworkSecurityGroups property: The Network Security Groups effective on the network interfaces + * of the protected resource. + * + * @return the effectiveNetworkSecurityGroups value. + */ + public List effectiveNetworkSecurityGroups() { + return this.effectiveNetworkSecurityGroups; + } + + /** + * Set the effectiveNetworkSecurityGroups property: The Network Security Groups effective on the network interfaces + * of the protected resource. + * + * @param effectiveNetworkSecurityGroups the effectiveNetworkSecurityGroups value to set. + * @return the AdaptiveNetworkHardeningInner object itself. + */ + public AdaptiveNetworkHardeningInner withEffectiveNetworkSecurityGroups( + List effectiveNetworkSecurityGroups) { + this.effectiveNetworkSecurityGroups = effectiveNetworkSecurityGroups; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (rules() != null) { + rules().forEach(e -> e.validate()); + } + if (effectiveNetworkSecurityGroups() != null) { + effectiveNetworkSecurityGroups().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AdvancedThreatProtectionSettingInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AdvancedThreatProtectionSettingInner.java new file mode 100644 index 000000000000..c632466c79a0 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AdvancedThreatProtectionSettingInner.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The Advanced Threat Protection resource. */ +@JsonFlatten +@Fluent +public class AdvancedThreatProtectionSettingInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AdvancedThreatProtectionSettingInner.class); + + /* + * Indicates whether Advanced Threat Protection is enabled. + */ + @JsonProperty(value = "properties.isEnabled") + private Boolean isEnabled; + + /** + * Get the isEnabled property: Indicates whether Advanced Threat Protection is enabled. + * + * @return the isEnabled value. + */ + public Boolean isEnabled() { + return this.isEnabled; + } + + /** + * Set the isEnabled property: Indicates whether Advanced Threat Protection is enabled. + * + * @param isEnabled the isEnabled value to set. + * @return the AdvancedThreatProtectionSettingInner object itself. + */ + public AdvancedThreatProtectionSettingInner withIsEnabled(Boolean isEnabled) { + this.isEnabled = isEnabled; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AlertInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AlertInner.java new file mode 100644 index 000000000000..ad7e64021e14 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AlertInner.java @@ -0,0 +1,420 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.models.AlertEntity; +import com.azure.resourcemanager.security.models.AlertSeverity; +import com.azure.resourcemanager.security.models.AlertStatus; +import com.azure.resourcemanager.security.models.Intent; +import com.azure.resourcemanager.security.models.ResourceIdentifier; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; + +/** Security alert. */ +@JsonFlatten +@Fluent +public class AlertInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AlertInner.class); + + /* + * Unique identifier for the detection logic (all alert instances from the + * same detection logic will have the same alertType). + */ + @JsonProperty(value = "properties.alertType", access = JsonProperty.Access.WRITE_ONLY) + private String alertType; + + /* + * Unique identifier for the alert. + */ + @JsonProperty(value = "properties.systemAlertId", access = JsonProperty.Access.WRITE_ONLY) + private String systemAlertId; + + /* + * The name of Azure Security Center pricing tier which powering this + * alert. Learn more: + * https://docs.microsoft.com/en-us/azure/security-center/security-center-pricing + */ + @JsonProperty(value = "properties.productComponentName", access = JsonProperty.Access.WRITE_ONLY) + private String productComponentName; + + /* + * The display name of the alert. + */ + @JsonProperty(value = "properties.alertDisplayName", access = JsonProperty.Access.WRITE_ONLY) + private String alertDisplayName; + + /* + * Description of the suspicious activity that was detected. + */ + @JsonProperty(value = "properties.description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /* + * The risk level of the threat that was detected. Learn more: + * https://docs.microsoft.com/en-us/azure/security-center/security-center-alerts-overview#how-are-alerts-classified. + */ + @JsonProperty(value = "properties.severity", access = JsonProperty.Access.WRITE_ONLY) + private AlertSeverity severity; + + /* + * The kill chain related intent behind the alert. For list of supported + * values, and explanations of Azure Security Center's supported kill chain + * intents. + */ + @JsonProperty(value = "properties.intent", access = JsonProperty.Access.WRITE_ONLY) + private Intent intent; + + /* + * The UTC time of the first event or activity included in the alert in + * ISO8601 format. + */ + @JsonProperty(value = "properties.startTimeUtc", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime startTimeUtc; + + /* + * The UTC time of the last event or activity included in the alert in + * ISO8601 format. + */ + @JsonProperty(value = "properties.endTimeUtc", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime endTimeUtc; + + /* + * The resource identifiers that can be used to direct the alert to the + * right product exposure group (tenant, workspace, subscription etc.). + * There can be multiple identifiers of different type per alert. + */ + @JsonProperty(value = "properties.resourceIdentifiers", access = JsonProperty.Access.WRITE_ONLY) + private List resourceIdentifiers; + + /* + * Manual action items to take to remediate the alert. + */ + @JsonProperty(value = "properties.remediationSteps", access = JsonProperty.Access.WRITE_ONLY) + private List remediationSteps; + + /* + * The name of the vendor that raises the alert. + */ + @JsonProperty(value = "properties.vendorName", access = JsonProperty.Access.WRITE_ONLY) + private String vendorName; + + /* + * The life cycle status of the alert. + */ + @JsonProperty(value = "properties.status", access = JsonProperty.Access.WRITE_ONLY) + private AlertStatus status; + + /* + * Links related to the alert + */ + @JsonProperty(value = "properties.extendedLinks", access = JsonProperty.Access.WRITE_ONLY) + private List> extendedLinks; + + /* + * A direct link to the alert page in Azure Portal. + */ + @JsonProperty(value = "properties.alertUri", access = JsonProperty.Access.WRITE_ONLY) + private String alertUri; + + /* + * The UTC time the alert was generated in ISO8601 format. + */ + @JsonProperty(value = "properties.timeGeneratedUtc", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime timeGeneratedUtc; + + /* + * The name of the product which published this alert (Azure Security + * Center, Azure ATP, Microsoft Defender ATP, O365 ATP, MCAS, and so on). + */ + @JsonProperty(value = "properties.productName", access = JsonProperty.Access.WRITE_ONLY) + private String productName; + + /* + * The UTC processing end time of the alert in ISO8601 format. + */ + @JsonProperty(value = "properties.processingEndTimeUtc", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime processingEndTimeUtc; + + /* + * A list of entities related to the alert. + */ + @JsonProperty(value = "properties.entities", access = JsonProperty.Access.WRITE_ONLY) + private List entities; + + /* + * This field determines whether the alert is an incident (a compound + * grouping of several alerts) or a single alert. + */ + @JsonProperty(value = "properties.isIncident", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isIncident; + + /* + * Key for corelating related alerts. Alerts with the same correlation key + * considered to be related. + */ + @JsonProperty(value = "properties.correlationKey", access = JsonProperty.Access.WRITE_ONLY) + private String correlationKey; + + /* + * Custom properties for the alert. + */ + @JsonProperty(value = "properties.extendedProperties") + private Map extendedProperties; + + /* + * The display name of the resource most related to this alert. + */ + @JsonProperty(value = "properties.compromisedEntity", access = JsonProperty.Access.WRITE_ONLY) + private String compromisedEntity; + + /** + * Get the alertType property: Unique identifier for the detection logic (all alert instances from the same + * detection logic will have the same alertType). + * + * @return the alertType value. + */ + public String alertType() { + return this.alertType; + } + + /** + * Get the systemAlertId property: Unique identifier for the alert. + * + * @return the systemAlertId value. + */ + public String systemAlertId() { + return this.systemAlertId; + } + + /** + * Get the productComponentName property: The name of Azure Security Center pricing tier which powering this alert. + * Learn more: https://docs.microsoft.com/en-us/azure/security-center/security-center-pricing. + * + * @return the productComponentName value. + */ + public String productComponentName() { + return this.productComponentName; + } + + /** + * Get the alertDisplayName property: The display name of the alert. + * + * @return the alertDisplayName value. + */ + public String alertDisplayName() { + return this.alertDisplayName; + } + + /** + * Get the description property: Description of the suspicious activity that was detected. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Get the severity property: The risk level of the threat that was detected. Learn more: + * https://docs.microsoft.com/en-us/azure/security-center/security-center-alerts-overview#how-are-alerts-classified. + * + * @return the severity value. + */ + public AlertSeverity severity() { + return this.severity; + } + + /** + * Get the intent property: The kill chain related intent behind the alert. For list of supported values, and + * explanations of Azure Security Center's supported kill chain intents. + * + * @return the intent value. + */ + public Intent intent() { + return this.intent; + } + + /** + * Get the startTimeUtc property: The UTC time of the first event or activity included in the alert in ISO8601 + * format. + * + * @return the startTimeUtc value. + */ + public OffsetDateTime startTimeUtc() { + return this.startTimeUtc; + } + + /** + * Get the endTimeUtc property: The UTC time of the last event or activity included in the alert in ISO8601 format. + * + * @return the endTimeUtc value. + */ + public OffsetDateTime endTimeUtc() { + return this.endTimeUtc; + } + + /** + * Get the resourceIdentifiers property: The resource identifiers that can be used to direct the alert to the right + * product exposure group (tenant, workspace, subscription etc.). There can be multiple identifiers of different + * type per alert. + * + * @return the resourceIdentifiers value. + */ + public List resourceIdentifiers() { + return this.resourceIdentifiers; + } + + /** + * Get the remediationSteps property: Manual action items to take to remediate the alert. + * + * @return the remediationSteps value. + */ + public List remediationSteps() { + return this.remediationSteps; + } + + /** + * Get the vendorName property: The name of the vendor that raises the alert. + * + * @return the vendorName value. + */ + public String vendorName() { + return this.vendorName; + } + + /** + * Get the status property: The life cycle status of the alert. + * + * @return the status value. + */ + public AlertStatus status() { + return this.status; + } + + /** + * Get the extendedLinks property: Links related to the alert. + * + * @return the extendedLinks value. + */ + public List> extendedLinks() { + return this.extendedLinks; + } + + /** + * Get the alertUri property: A direct link to the alert page in Azure Portal. + * + * @return the alertUri value. + */ + public String alertUri() { + return this.alertUri; + } + + /** + * Get the timeGeneratedUtc property: The UTC time the alert was generated in ISO8601 format. + * + * @return the timeGeneratedUtc value. + */ + public OffsetDateTime timeGeneratedUtc() { + return this.timeGeneratedUtc; + } + + /** + * Get the productName property: The name of the product which published this alert (Azure Security Center, Azure + * ATP, Microsoft Defender ATP, O365 ATP, MCAS, and so on). + * + * @return the productName value. + */ + public String productName() { + return this.productName; + } + + /** + * Get the processingEndTimeUtc property: The UTC processing end time of the alert in ISO8601 format. + * + * @return the processingEndTimeUtc value. + */ + public OffsetDateTime processingEndTimeUtc() { + return this.processingEndTimeUtc; + } + + /** + * Get the entities property: A list of entities related to the alert. + * + * @return the entities value. + */ + public List entities() { + return this.entities; + } + + /** + * Get the isIncident property: This field determines whether the alert is an incident (a compound grouping of + * several alerts) or a single alert. + * + * @return the isIncident value. + */ + public Boolean isIncident() { + return this.isIncident; + } + + /** + * Get the correlationKey property: Key for corelating related alerts. Alerts with the same correlation key + * considered to be related. + * + * @return the correlationKey value. + */ + public String correlationKey() { + return this.correlationKey; + } + + /** + * Get the extendedProperties property: Custom properties for the alert. + * + * @return the extendedProperties value. + */ + public Map extendedProperties() { + return this.extendedProperties; + } + + /** + * Set the extendedProperties property: Custom properties for the alert. + * + * @param extendedProperties the extendedProperties value to set. + * @return the AlertInner object itself. + */ + public AlertInner withExtendedProperties(Map extendedProperties) { + this.extendedProperties = extendedProperties; + return this; + } + + /** + * Get the compromisedEntity property: The display name of the resource most related to this alert. + * + * @return the compromisedEntity value. + */ + public String compromisedEntity() { + return this.compromisedEntity; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (resourceIdentifiers() != null) { + resourceIdentifiers().forEach(e -> e.validate()); + } + if (entities() != null) { + entities().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AlertsSuppressionRuleInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AlertsSuppressionRuleInner.java new file mode 100644 index 000000000000..b5caf1f52bd0 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AlertsSuppressionRuleInner.java @@ -0,0 +1,208 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.models.RuleState; +import com.azure.resourcemanager.security.models.SuppressionAlertsScope; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Describes the suppression rule. */ +@JsonFlatten +@Fluent +public class AlertsSuppressionRuleInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AlertsSuppressionRuleInner.class); + + /* + * Type of the alert to automatically suppress. For all alert types, use + * '*' + */ + @JsonProperty(value = "properties.alertType") + private String alertType; + + /* + * The last time this rule was modified + */ + @JsonProperty(value = "properties.lastModifiedUtc", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime lastModifiedUtc; + + /* + * Expiration date of the rule, if value is not provided or provided as + * null this field will default to the maximum allowed expiration date. + */ + @JsonProperty(value = "properties.expirationDateUtc") + private OffsetDateTime expirationDateUtc; + + /* + * The reason for dismissing the alert + */ + @JsonProperty(value = "properties.reason") + private String reason; + + /* + * Possible states of the rule + */ + @JsonProperty(value = "properties.state") + private RuleState state; + + /* + * Any comment regarding the rule + */ + @JsonProperty(value = "properties.comment") + private String comment; + + /* + * The suppression conditions + */ + @JsonProperty(value = "properties.suppressionAlertsScope") + private SuppressionAlertsScope suppressionAlertsScope; + + /** + * Get the alertType property: Type of the alert to automatically suppress. For all alert types, use '*'. + * + * @return the alertType value. + */ + public String alertType() { + return this.alertType; + } + + /** + * Set the alertType property: Type of the alert to automatically suppress. For all alert types, use '*'. + * + * @param alertType the alertType value to set. + * @return the AlertsSuppressionRuleInner object itself. + */ + public AlertsSuppressionRuleInner withAlertType(String alertType) { + this.alertType = alertType; + return this; + } + + /** + * Get the lastModifiedUtc property: The last time this rule was modified. + * + * @return the lastModifiedUtc value. + */ + public OffsetDateTime lastModifiedUtc() { + return this.lastModifiedUtc; + } + + /** + * Get the expirationDateUtc property: Expiration date of the rule, if value is not provided or provided as null + * this field will default to the maximum allowed expiration date. + * + * @return the expirationDateUtc value. + */ + public OffsetDateTime expirationDateUtc() { + return this.expirationDateUtc; + } + + /** + * Set the expirationDateUtc property: Expiration date of the rule, if value is not provided or provided as null + * this field will default to the maximum allowed expiration date. + * + * @param expirationDateUtc the expirationDateUtc value to set. + * @return the AlertsSuppressionRuleInner object itself. + */ + public AlertsSuppressionRuleInner withExpirationDateUtc(OffsetDateTime expirationDateUtc) { + this.expirationDateUtc = expirationDateUtc; + return this; + } + + /** + * Get the reason property: The reason for dismissing the alert. + * + * @return the reason value. + */ + public String reason() { + return this.reason; + } + + /** + * Set the reason property: The reason for dismissing the alert. + * + * @param reason the reason value to set. + * @return the AlertsSuppressionRuleInner object itself. + */ + public AlertsSuppressionRuleInner withReason(String reason) { + this.reason = reason; + return this; + } + + /** + * Get the state property: Possible states of the rule. + * + * @return the state value. + */ + public RuleState state() { + return this.state; + } + + /** + * Set the state property: Possible states of the rule. + * + * @param state the state value to set. + * @return the AlertsSuppressionRuleInner object itself. + */ + public AlertsSuppressionRuleInner withState(RuleState state) { + this.state = state; + return this; + } + + /** + * Get the comment property: Any comment regarding the rule. + * + * @return the comment value. + */ + public String comment() { + return this.comment; + } + + /** + * Set the comment property: Any comment regarding the rule. + * + * @param comment the comment value to set. + * @return the AlertsSuppressionRuleInner object itself. + */ + public AlertsSuppressionRuleInner withComment(String comment) { + this.comment = comment; + return this; + } + + /** + * Get the suppressionAlertsScope property: The suppression conditions. + * + * @return the suppressionAlertsScope value. + */ + public SuppressionAlertsScope suppressionAlertsScope() { + return this.suppressionAlertsScope; + } + + /** + * Set the suppressionAlertsScope property: The suppression conditions. + * + * @param suppressionAlertsScope the suppressionAlertsScope value to set. + * @return the AlertsSuppressionRuleInner object itself. + */ + public AlertsSuppressionRuleInner withSuppressionAlertsScope(SuppressionAlertsScope suppressionAlertsScope) { + this.suppressionAlertsScope = suppressionAlertsScope; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (suppressionAlertsScope() != null) { + suppressionAlertsScope().validate(); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AllowedConnectionsResourceInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AllowedConnectionsResourceInner.java new file mode 100644 index 000000000000..ac7921e03ee6 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AllowedConnectionsResourceInner.java @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.models.ConnectableResource; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** The resource whose properties describes the allowed traffic between Azure resources. */ +@JsonFlatten +@Immutable +public class AllowedConnectionsResourceInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AllowedConnectionsResourceInner.class); + + /* + * The UTC time on which the allowed connections resource was calculated + */ + @JsonProperty(value = "properties.calculatedDateTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime calculatedDateTime; + + /* + * List of connectable resources + */ + @JsonProperty(value = "properties.connectableResources", access = JsonProperty.Access.WRITE_ONLY) + private List connectableResources; + + /* + * Location where the resource is stored + */ + @JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY) + private String location; + + /** + * Get the calculatedDateTime property: The UTC time on which the allowed connections resource was calculated. + * + * @return the calculatedDateTime value. + */ + public OffsetDateTime calculatedDateTime() { + return this.calculatedDateTime; + } + + /** + * Get the connectableResources property: List of connectable resources. + * + * @return the connectableResources value. + */ + public List connectableResources() { + return this.connectableResources; + } + + /** + * Get the location property: Location where the resource is stored. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (connectableResources() != null) { + connectableResources().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AscLocationInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AscLocationInner.java new file mode 100644 index 000000000000..1c279f17f98a --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AscLocationInner.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The ASC location of the subscription is in the "name" field. */ +@Fluent +public final class AscLocationInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AscLocationInner.class); + + /* + * Any object + */ + @JsonProperty(value = "properties") + private Object properties; + + /** + * Get the properties property: Any object. + * + * @return the properties value. + */ + public Object properties() { + return this.properties; + } + + /** + * Set the properties property: Any object. + * + * @param properties the properties value to set. + * @return the AscLocationInner object itself. + */ + public AscLocationInner withProperties(Object properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AutoProvisioningSettingInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AutoProvisioningSettingInner.java new file mode 100644 index 000000000000..610be89c5ce2 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AutoProvisioningSettingInner.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.models.AutoProvision; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Auto provisioning setting. */ +@JsonFlatten +@Fluent +public class AutoProvisioningSettingInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AutoProvisioningSettingInner.class); + + /* + * Describes what kind of security agent provisioning action to take + */ + @JsonProperty(value = "properties.autoProvision") + private AutoProvision autoProvision; + + /** + * Get the autoProvision property: Describes what kind of security agent provisioning action to take. + * + * @return the autoProvision value. + */ + public AutoProvision autoProvision() { + return this.autoProvision; + } + + /** + * Set the autoProvision property: Describes what kind of security agent provisioning action to take. + * + * @param autoProvision the autoProvision value to set. + * @return the AutoProvisioningSettingInner object itself. + */ + public AutoProvisioningSettingInner withAutoProvision(AutoProvision autoProvision) { + this.autoProvision = autoProvision; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AutomationInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AutomationInner.java new file mode 100644 index 000000000000..a1fb76d81b55 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AutomationInner.java @@ -0,0 +1,198 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.Resource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.models.AutomationAction; +import com.azure.resourcemanager.security.models.AutomationScope; +import com.azure.resourcemanager.security.models.AutomationSource; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** The security automation resource. */ +@JsonFlatten +@Fluent +public class AutomationInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AutomationInner.class); + + /* + * The security automation description. + */ + @JsonProperty(value = "properties.description") + private String description; + + /* + * Indicates whether the security automation is enabled. + */ + @JsonProperty(value = "properties.isEnabled") + private Boolean isEnabled; + + /* + * A collection of scopes on which the security automations logic is + * applied. Supported scopes are the subscription itself or a resource + * group under that subscription. The automation will only apply on defined + * scopes. + */ + @JsonProperty(value = "properties.scopes") + private List scopes; + + /* + * A collection of the source event types which evaluate the security + * automation set of rules. + */ + @JsonProperty(value = "properties.sources") + private List sources; + + /* + * A collection of the actions which are triggered if all the configured + * rules evaluations, within at least one rule set, are true. + */ + @JsonProperty(value = "properties.actions") + private List actions; + + /** + * Get the description property: The security automation description. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: The security automation description. + * + * @param description the description value to set. + * @return the AutomationInner object itself. + */ + public AutomationInner withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the isEnabled property: Indicates whether the security automation is enabled. + * + * @return the isEnabled value. + */ + public Boolean isEnabled() { + return this.isEnabled; + } + + /** + * Set the isEnabled property: Indicates whether the security automation is enabled. + * + * @param isEnabled the isEnabled value to set. + * @return the AutomationInner object itself. + */ + public AutomationInner withIsEnabled(Boolean isEnabled) { + this.isEnabled = isEnabled; + return this; + } + + /** + * Get the scopes property: A collection of scopes on which the security automations logic is applied. Supported + * scopes are the subscription itself or a resource group under that subscription. The automation will only apply on + * defined scopes. + * + * @return the scopes value. + */ + public List scopes() { + return this.scopes; + } + + /** + * Set the scopes property: A collection of scopes on which the security automations logic is applied. Supported + * scopes are the subscription itself or a resource group under that subscription. The automation will only apply on + * defined scopes. + * + * @param scopes the scopes value to set. + * @return the AutomationInner object itself. + */ + public AutomationInner withScopes(List scopes) { + this.scopes = scopes; + return this; + } + + /** + * Get the sources property: A collection of the source event types which evaluate the security automation set of + * rules. + * + * @return the sources value. + */ + public List sources() { + return this.sources; + } + + /** + * Set the sources property: A collection of the source event types which evaluate the security automation set of + * rules. + * + * @param sources the sources value to set. + * @return the AutomationInner object itself. + */ + public AutomationInner withSources(List sources) { + this.sources = sources; + return this; + } + + /** + * Get the actions property: A collection of the actions which are triggered if all the configured rules + * evaluations, within at least one rule set, are true. + * + * @return the actions value. + */ + public List actions() { + return this.actions; + } + + /** + * Set the actions property: A collection of the actions which are triggered if all the configured rules + * evaluations, within at least one rule set, are true. + * + * @param actions the actions value to set. + * @return the AutomationInner object itself. + */ + public AutomationInner withActions(List actions) { + this.actions = actions; + return this; + } + + /** {@inheritDoc} */ + @Override + public AutomationInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public AutomationInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (scopes() != null) { + scopes().forEach(e -> e.validate()); + } + if (sources() != null) { + sources().forEach(e -> e.validate()); + } + if (actions() != null) { + actions().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AutomationValidationStatusInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AutomationValidationStatusInner.java new file mode 100644 index 000000000000..792f2e95f1bd --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AutomationValidationStatusInner.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The security automation model state property bag. */ +@Fluent +public final class AutomationValidationStatusInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AutomationValidationStatusInner.class); + + /* + * Indicates whether the model is valid or not. + */ + @JsonProperty(value = "isValid") + private Boolean isValid; + + /* + * The validation message. + */ + @JsonProperty(value = "message") + private String message; + + /** + * Get the isValid property: Indicates whether the model is valid or not. + * + * @return the isValid value. + */ + public Boolean isValid() { + return this.isValid; + } + + /** + * Set the isValid property: Indicates whether the model is valid or not. + * + * @param isValid the isValid value to set. + * @return the AutomationValidationStatusInner object itself. + */ + public AutomationValidationStatusInner withIsValid(Boolean isValid) { + this.isValid = isValid; + return this; + } + + /** + * Get the message property: The validation message. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * Set the message property: The validation message. + * + * @param message the message value to set. + * @return the AutomationValidationStatusInner object itself. + */ + public AutomationValidationStatusInner withMessage(String message) { + this.message = message; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ComplianceInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ComplianceInner.java new file mode 100644 index 000000000000..a06540a17774 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ComplianceInner.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.models.ComplianceSegment; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** Compliance of a scope. */ +@JsonFlatten +@Immutable +public class ComplianceInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ComplianceInner.class); + + /* + * The timestamp when the Compliance calculation was conducted. + */ + @JsonProperty(value = "properties.assessmentTimestampUtcDate", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime assessmentTimestampUtcDate; + + /* + * The resource count of the given subscription for which the Compliance + * calculation was conducted (needed for Management Group Compliance + * calculation). + */ + @JsonProperty(value = "properties.resourceCount", access = JsonProperty.Access.WRITE_ONLY) + private Integer resourceCount; + + /* + * An array of segment, which is the actually the compliance assessment. + */ + @JsonProperty(value = "properties.assessmentResult", access = JsonProperty.Access.WRITE_ONLY) + private List assessmentResult; + + /** + * Get the assessmentTimestampUtcDate property: The timestamp when the Compliance calculation was conducted. + * + * @return the assessmentTimestampUtcDate value. + */ + public OffsetDateTime assessmentTimestampUtcDate() { + return this.assessmentTimestampUtcDate; + } + + /** + * Get the resourceCount property: The resource count of the given subscription for which the Compliance calculation + * was conducted (needed for Management Group Compliance calculation). + * + * @return the resourceCount value. + */ + public Integer resourceCount() { + return this.resourceCount; + } + + /** + * Get the assessmentResult property: An array of segment, which is the actually the compliance assessment. + * + * @return the assessmentResult value. + */ + public List assessmentResult() { + return this.assessmentResult; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (assessmentResult() != null) { + assessmentResult().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ComplianceResultInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ComplianceResultInner.java new file mode 100644 index 000000000000..e41e6c39a1a6 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ComplianceResultInner.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.models.ResourceStatus; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** a compliance result. */ +@JsonFlatten +@Immutable +public class ComplianceResultInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ComplianceResultInner.class); + + /* + * The status of the resource regarding a single assessment + */ + @JsonProperty(value = "properties.resourceStatus", access = JsonProperty.Access.WRITE_ONLY) + private ResourceStatus resourceStatus; + + /** + * Get the resourceStatus property: The status of the resource regarding a single assessment. + * + * @return the resourceStatus value. + */ + public ResourceStatus resourceStatus() { + return this.resourceStatus; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ConnectionStringsInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ConnectionStringsInner.java new file mode 100644 index 000000000000..7bec244e18e0 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ConnectionStringsInner.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.models.IngestionConnectionString; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Connection string for ingesting security data and logs. */ +@Fluent +public final class ConnectionStringsInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ConnectionStringsInner.class); + + /* + * Connection strings + */ + @JsonProperty(value = "value", required = true) + private List value; + + /** + * Get the value property: Connection strings. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Connection strings. + * + * @param value the value value to set. + * @return the ConnectionStringsInner object itself. + */ + public ConnectionStringsInner withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property value in model ConnectionStringsInner")); + } else { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ConnectorSettingInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ConnectorSettingInner.java new file mode 100644 index 000000000000..30a242a9b38d --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ConnectorSettingInner.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.models.AuthenticationDetailsProperties; +import com.azure.resourcemanager.security.models.HybridComputeSettingsProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The connector setting. */ +@JsonFlatten +@Fluent +public class ConnectorSettingInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ConnectorSettingInner.class); + + /* + * Settings for hybrid compute management. These settings are relevant only + * for Arc autoProvision (Hybrid Compute). + */ + @JsonProperty(value = "properties.hybridComputeSettings") + private HybridComputeSettingsProperties hybridComputeSettings; + + /* + * Settings for authentication management, these settings are relevant only + * for the cloud connector. + */ + @JsonProperty(value = "properties.authenticationDetails") + private AuthenticationDetailsProperties authenticationDetails; + + /** + * Get the hybridComputeSettings property: Settings for hybrid compute management. These settings are relevant only + * for Arc autoProvision (Hybrid Compute). + * + * @return the hybridComputeSettings value. + */ + public HybridComputeSettingsProperties hybridComputeSettings() { + return this.hybridComputeSettings; + } + + /** + * Set the hybridComputeSettings property: Settings for hybrid compute management. These settings are relevant only + * for Arc autoProvision (Hybrid Compute). + * + * @param hybridComputeSettings the hybridComputeSettings value to set. + * @return the ConnectorSettingInner object itself. + */ + public ConnectorSettingInner withHybridComputeSettings(HybridComputeSettingsProperties hybridComputeSettings) { + this.hybridComputeSettings = hybridComputeSettings; + return this; + } + + /** + * Get the authenticationDetails property: Settings for authentication management, these settings are relevant only + * for the cloud connector. + * + * @return the authenticationDetails value. + */ + public AuthenticationDetailsProperties authenticationDetails() { + return this.authenticationDetails; + } + + /** + * Set the authenticationDetails property: Settings for authentication management, these settings are relevant only + * for the cloud connector. + * + * @param authenticationDetails the authenticationDetails value to set. + * @return the ConnectorSettingInner object itself. + */ + public ConnectorSettingInner withAuthenticationDetails(AuthenticationDetailsProperties authenticationDetails) { + this.authenticationDetails = authenticationDetails; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (hybridComputeSettings() != null) { + hybridComputeSettings().validate(); + } + if (authenticationDetails() != null) { + authenticationDetails().validate(); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/DeviceInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/DeviceInner.java new file mode 100644 index 000000000000..7c2676265df7 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/DeviceInner.java @@ -0,0 +1,493 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.models.AuthorizationState; +import com.azure.resourcemanager.security.models.DeviceCriticality; +import com.azure.resourcemanager.security.models.DeviceStatus; +import com.azure.resourcemanager.security.models.Firmware; +import com.azure.resourcemanager.security.models.ManagementState; +import com.azure.resourcemanager.security.models.NetworkInterface; +import com.azure.resourcemanager.security.models.ProgrammingState; +import com.azure.resourcemanager.security.models.Protocol; +import com.azure.resourcemanager.security.models.PurdueLevel; +import com.azure.resourcemanager.security.models.ScanningFunctionality; +import com.azure.resourcemanager.security.models.Sensor; +import com.azure.resourcemanager.security.models.Site; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** Device model. */ +@JsonFlatten +@Fluent +public class DeviceInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DeviceInner.class); + + /* + * Device display name given by the collector + */ + @JsonProperty(value = "properties.displayName") + private String displayName; + + /* + * Device type. + */ + @JsonProperty(value = "properties.deviceType") + private String deviceType; + + /* + * The source that created the device + */ + @JsonProperty(value = "properties.sourceName", access = JsonProperty.Access.WRITE_ONLY) + private String sourceName; + + /* + * List of network interfaces. + */ + @JsonProperty(value = "properties.networkInterfaces", access = JsonProperty.Access.WRITE_ONLY) + private List networkInterfaces; + + /* + * Device vendor + */ + @JsonProperty(value = "properties.vendor", access = JsonProperty.Access.WRITE_ONLY) + private String vendor; + + /* + * Device operating system name. + */ + @JsonProperty(value = "properties.osName") + private String osName; + + /* + * List of protocols. + */ + @JsonProperty(value = "properties.protocols", access = JsonProperty.Access.WRITE_ONLY) + private List protocols; + + /* + * last time the device was active in the network + */ + @JsonProperty(value = "properties.lastActiveTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime lastActiveTime; + + /* + * last time the device was updated + */ + @JsonProperty(value = "properties.lastUpdateTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime lastUpdateTime; + + /* + * Managed state of the device. + */ + @JsonProperty(value = "properties.managementState", access = JsonProperty.Access.WRITE_ONLY) + private ManagementState managementState; + + /* + * Authorized state of the device. + */ + @JsonProperty(value = "properties.authorizationState") + private AuthorizationState authorizationState; + + /* + * Device criticality. + */ + @JsonProperty(value = "properties.deviceCriticality") + private DeviceCriticality deviceCriticality; + + /* + * Purdue level of the device. + */ + @JsonProperty(value = "properties.purdueLevel") + private PurdueLevel purdueLevel; + + /* + * user notes for the device, up to 300 characters. + */ + @JsonProperty(value = "properties.notes") + private String notes; + + /* + * List of device firmwares. + */ + @JsonProperty(value = "properties.firmwares", access = JsonProperty.Access.WRITE_ONLY) + private List firmwares; + + /* + * Discovered time of the device. + */ + @JsonProperty(value = "properties.discoveryTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime discoveryTime; + + /* + * Indicates whether this device is programming + */ + @JsonProperty(value = "properties.programmingState", access = JsonProperty.Access.WRITE_ONLY) + private ProgrammingState programmingState; + + /* + * last time the device was programming or programed. + */ + @JsonProperty(value = "properties.lastProgrammingTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime lastProgrammingTime; + + /* + * Indicates whether the device is a scanner + */ + @JsonProperty(value = "properties.scanningFunctionality", access = JsonProperty.Access.WRITE_ONLY) + private ScanningFunctionality scanningFunctionality; + + /* + * last time the device was scanning. + */ + @JsonProperty(value = "properties.lastScanTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime lastScanTime; + + /* + * risk score of the device. + */ + @JsonProperty(value = "properties.riskScore", access = JsonProperty.Access.WRITE_ONLY) + private Integer riskScore; + + /* + * List of sensors that scanned this device. + */ + @JsonProperty(value = "properties.sensors", access = JsonProperty.Access.WRITE_ONLY) + private List sensors; + + /* + * Site data + */ + @JsonProperty(value = "properties.site", access = JsonProperty.Access.WRITE_ONLY) + private Site site; + + /* + * Device status. + */ + @JsonProperty(value = "properties.deviceStatus", access = JsonProperty.Access.WRITE_ONLY) + private DeviceStatus deviceStatus; + + /** + * Get the displayName property: Device display name given by the collector. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName property: Device display name given by the collector. + * + * @param displayName the displayName value to set. + * @return the DeviceInner object itself. + */ + public DeviceInner withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the deviceType property: Device type. + * + * @return the deviceType value. + */ + public String deviceType() { + return this.deviceType; + } + + /** + * Set the deviceType property: Device type. + * + * @param deviceType the deviceType value to set. + * @return the DeviceInner object itself. + */ + public DeviceInner withDeviceType(String deviceType) { + this.deviceType = deviceType; + return this; + } + + /** + * Get the sourceName property: The source that created the device. + * + * @return the sourceName value. + */ + public String sourceName() { + return this.sourceName; + } + + /** + * Get the networkInterfaces property: List of network interfaces. + * + * @return the networkInterfaces value. + */ + public List networkInterfaces() { + return this.networkInterfaces; + } + + /** + * Get the vendor property: Device vendor. + * + * @return the vendor value. + */ + public String vendor() { + return this.vendor; + } + + /** + * Get the osName property: Device operating system name. + * + * @return the osName value. + */ + public String osName() { + return this.osName; + } + + /** + * Set the osName property: Device operating system name. + * + * @param osName the osName value to set. + * @return the DeviceInner object itself. + */ + public DeviceInner withOsName(String osName) { + this.osName = osName; + return this; + } + + /** + * Get the protocols property: List of protocols. + * + * @return the protocols value. + */ + public List protocols() { + return this.protocols; + } + + /** + * Get the lastActiveTime property: last time the device was active in the network. + * + * @return the lastActiveTime value. + */ + public OffsetDateTime lastActiveTime() { + return this.lastActiveTime; + } + + /** + * Get the lastUpdateTime property: last time the device was updated. + * + * @return the lastUpdateTime value. + */ + public OffsetDateTime lastUpdateTime() { + return this.lastUpdateTime; + } + + /** + * Get the managementState property: Managed state of the device. + * + * @return the managementState value. + */ + public ManagementState managementState() { + return this.managementState; + } + + /** + * Get the authorizationState property: Authorized state of the device. + * + * @return the authorizationState value. + */ + public AuthorizationState authorizationState() { + return this.authorizationState; + } + + /** + * Set the authorizationState property: Authorized state of the device. + * + * @param authorizationState the authorizationState value to set. + * @return the DeviceInner object itself. + */ + public DeviceInner withAuthorizationState(AuthorizationState authorizationState) { + this.authorizationState = authorizationState; + return this; + } + + /** + * Get the deviceCriticality property: Device criticality. + * + * @return the deviceCriticality value. + */ + public DeviceCriticality deviceCriticality() { + return this.deviceCriticality; + } + + /** + * Set the deviceCriticality property: Device criticality. + * + * @param deviceCriticality the deviceCriticality value to set. + * @return the DeviceInner object itself. + */ + public DeviceInner withDeviceCriticality(DeviceCriticality deviceCriticality) { + this.deviceCriticality = deviceCriticality; + return this; + } + + /** + * Get the purdueLevel property: Purdue level of the device. + * + * @return the purdueLevel value. + */ + public PurdueLevel purdueLevel() { + return this.purdueLevel; + } + + /** + * Set the purdueLevel property: Purdue level of the device. + * + * @param purdueLevel the purdueLevel value to set. + * @return the DeviceInner object itself. + */ + public DeviceInner withPurdueLevel(PurdueLevel purdueLevel) { + this.purdueLevel = purdueLevel; + return this; + } + + /** + * Get the notes property: user notes for the device, up to 300 characters. + * + * @return the notes value. + */ + public String notes() { + return this.notes; + } + + /** + * Set the notes property: user notes for the device, up to 300 characters. + * + * @param notes the notes value to set. + * @return the DeviceInner object itself. + */ + public DeviceInner withNotes(String notes) { + this.notes = notes; + return this; + } + + /** + * Get the firmwares property: List of device firmwares. + * + * @return the firmwares value. + */ + public List firmwares() { + return this.firmwares; + } + + /** + * Get the discoveryTime property: Discovered time of the device. + * + * @return the discoveryTime value. + */ + public OffsetDateTime discoveryTime() { + return this.discoveryTime; + } + + /** + * Get the programmingState property: Indicates whether this device is programming. + * + * @return the programmingState value. + */ + public ProgrammingState programmingState() { + return this.programmingState; + } + + /** + * Get the lastProgrammingTime property: last time the device was programming or programed. + * + * @return the lastProgrammingTime value. + */ + public OffsetDateTime lastProgrammingTime() { + return this.lastProgrammingTime; + } + + /** + * Get the scanningFunctionality property: Indicates whether the device is a scanner. + * + * @return the scanningFunctionality value. + */ + public ScanningFunctionality scanningFunctionality() { + return this.scanningFunctionality; + } + + /** + * Get the lastScanTime property: last time the device was scanning. + * + * @return the lastScanTime value. + */ + public OffsetDateTime lastScanTime() { + return this.lastScanTime; + } + + /** + * Get the riskScore property: risk score of the device. + * + * @return the riskScore value. + */ + public Integer riskScore() { + return this.riskScore; + } + + /** + * Get the sensors property: List of sensors that scanned this device. + * + * @return the sensors value. + */ + public List sensors() { + return this.sensors; + } + + /** + * Get the site property: Site data. + * + * @return the site value. + */ + public Site site() { + return this.site; + } + + /** + * Get the deviceStatus property: Device status. + * + * @return the deviceStatus value. + */ + public DeviceStatus deviceStatus() { + return this.deviceStatus; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (networkInterfaces() != null) { + networkInterfaces().forEach(e -> e.validate()); + } + if (protocols() != null) { + protocols().forEach(e -> e.validate()); + } + if (firmwares() != null) { + firmwares().forEach(e -> e.validate()); + } + if (sensors() != null) { + sensors().forEach(e -> e.validate()); + } + if (site() != null) { + site().validate(); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/DeviceSecurityGroupInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/DeviceSecurityGroupInner.java new file mode 100644 index 000000000000..8e79718371e8 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/DeviceSecurityGroupInner.java @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.models.AllowlistCustomAlertRule; +import com.azure.resourcemanager.security.models.DenylistCustomAlertRule; +import com.azure.resourcemanager.security.models.ThresholdCustomAlertRule; +import com.azure.resourcemanager.security.models.TimeWindowCustomAlertRule; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The device security group resource. */ +@JsonFlatten +@Fluent +public class DeviceSecurityGroupInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DeviceSecurityGroupInner.class); + + /* + * The list of custom alert threshold rules. + */ + @JsonProperty(value = "properties.thresholdRules") + private List thresholdRules; + + /* + * The list of custom alert time-window rules. + */ + @JsonProperty(value = "properties.timeWindowRules") + private List timeWindowRules; + + /* + * The allow-list custom alert rules. + */ + @JsonProperty(value = "properties.allowlistRules") + private List allowlistRules; + + /* + * The deny-list custom alert rules. + */ + @JsonProperty(value = "properties.denylistRules") + private List denylistRules; + + /** + * Get the thresholdRules property: The list of custom alert threshold rules. + * + * @return the thresholdRules value. + */ + public List thresholdRules() { + return this.thresholdRules; + } + + /** + * Set the thresholdRules property: The list of custom alert threshold rules. + * + * @param thresholdRules the thresholdRules value to set. + * @return the DeviceSecurityGroupInner object itself. + */ + public DeviceSecurityGroupInner withThresholdRules(List thresholdRules) { + this.thresholdRules = thresholdRules; + return this; + } + + /** + * Get the timeWindowRules property: The list of custom alert time-window rules. + * + * @return the timeWindowRules value. + */ + public List timeWindowRules() { + return this.timeWindowRules; + } + + /** + * Set the timeWindowRules property: The list of custom alert time-window rules. + * + * @param timeWindowRules the timeWindowRules value to set. + * @return the DeviceSecurityGroupInner object itself. + */ + public DeviceSecurityGroupInner withTimeWindowRules(List timeWindowRules) { + this.timeWindowRules = timeWindowRules; + return this; + } + + /** + * Get the allowlistRules property: The allow-list custom alert rules. + * + * @return the allowlistRules value. + */ + public List allowlistRules() { + return this.allowlistRules; + } + + /** + * Set the allowlistRules property: The allow-list custom alert rules. + * + * @param allowlistRules the allowlistRules value to set. + * @return the DeviceSecurityGroupInner object itself. + */ + public DeviceSecurityGroupInner withAllowlistRules(List allowlistRules) { + this.allowlistRules = allowlistRules; + return this; + } + + /** + * Get the denylistRules property: The deny-list custom alert rules. + * + * @return the denylistRules value. + */ + public List denylistRules() { + return this.denylistRules; + } + + /** + * Set the denylistRules property: The deny-list custom alert rules. + * + * @param denylistRules the denylistRules value to set. + * @return the DeviceSecurityGroupInner object itself. + */ + public DeviceSecurityGroupInner withDenylistRules(List denylistRules) { + this.denylistRules = denylistRules; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (thresholdRules() != null) { + thresholdRules().forEach(e -> e.validate()); + } + if (timeWindowRules() != null) { + timeWindowRules().forEach(e -> e.validate()); + } + if (allowlistRules() != null) { + allowlistRules().forEach(e -> e.validate()); + } + if (denylistRules() != null) { + denylistRules().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/DiscoveredSecuritySolutionInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/DiscoveredSecuritySolutionInner.java new file mode 100644 index 000000000000..e176ea96fe7a --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/DiscoveredSecuritySolutionInner.java @@ -0,0 +1,171 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.models.SecurityFamily; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The DiscoveredSecuritySolution model. */ +@JsonFlatten +@Fluent +public class DiscoveredSecuritySolutionInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DiscoveredSecuritySolutionInner.class); + + /* + * The security family of the discovered solution + */ + @JsonProperty(value = "properties.securityFamily", required = true) + private SecurityFamily securityFamily; + + /* + * The security solutions' image offer + */ + @JsonProperty(value = "properties.offer", required = true) + private String offer; + + /* + * The security solutions' image publisher + */ + @JsonProperty(value = "properties.publisher", required = true) + private String publisher; + + /* + * The security solutions' image sku + */ + @JsonProperty(value = "properties.sku", required = true) + private String sku; + + /* + * Location where the resource is stored + */ + @JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY) + private String location; + + /** + * Get the securityFamily property: The security family of the discovered solution. + * + * @return the securityFamily value. + */ + public SecurityFamily securityFamily() { + return this.securityFamily; + } + + /** + * Set the securityFamily property: The security family of the discovered solution. + * + * @param securityFamily the securityFamily value to set. + * @return the DiscoveredSecuritySolutionInner object itself. + */ + public DiscoveredSecuritySolutionInner withSecurityFamily(SecurityFamily securityFamily) { + this.securityFamily = securityFamily; + return this; + } + + /** + * Get the offer property: The security solutions' image offer. + * + * @return the offer value. + */ + public String offer() { + return this.offer; + } + + /** + * Set the offer property: The security solutions' image offer. + * + * @param offer the offer value to set. + * @return the DiscoveredSecuritySolutionInner object itself. + */ + public DiscoveredSecuritySolutionInner withOffer(String offer) { + this.offer = offer; + return this; + } + + /** + * Get the publisher property: The security solutions' image publisher. + * + * @return the publisher value. + */ + public String publisher() { + return this.publisher; + } + + /** + * Set the publisher property: The security solutions' image publisher. + * + * @param publisher the publisher value to set. + * @return the DiscoveredSecuritySolutionInner object itself. + */ + public DiscoveredSecuritySolutionInner withPublisher(String publisher) { + this.publisher = publisher; + return this; + } + + /** + * Get the sku property: The security solutions' image sku. + * + * @return the sku value. + */ + public String sku() { + return this.sku; + } + + /** + * Set the sku property: The security solutions' image sku. + * + * @param sku the sku value to set. + * @return the DiscoveredSecuritySolutionInner object itself. + */ + public DiscoveredSecuritySolutionInner withSku(String sku) { + this.sku = sku; + return this; + } + + /** + * Get the location property: Location where the resource is stored. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (securityFamily() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property securityFamily in model DiscoveredSecuritySolutionInner")); + } + if (offer() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property offer in model DiscoveredSecuritySolutionInner")); + } + if (publisher() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property publisher in model DiscoveredSecuritySolutionInner")); + } + if (sku() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property sku in model DiscoveredSecuritySolutionInner")); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ExternalSecuritySolutionInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ExternalSecuritySolutionInner.java new file mode 100644 index 000000000000..64175e462efd --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ExternalSecuritySolutionInner.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.models.AadExternalSecuritySolution; +import com.azure.resourcemanager.security.models.AtaExternalSecuritySolution; +import com.azure.resourcemanager.security.models.CefExternalSecuritySolution; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * Represents a security solution external to Azure Security Center which sends information to an OMS workspace and + * whose data is displayed by Azure Security Center. + */ +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "kind", + defaultImpl = ExternalSecuritySolutionInner.class) +@JsonTypeName("ExternalSecuritySolution") +@JsonSubTypes({ + @JsonSubTypes.Type(name = "CEF", value = CefExternalSecuritySolution.class), + @JsonSubTypes.Type(name = "ATA", value = AtaExternalSecuritySolution.class), + @JsonSubTypes.Type(name = "AAD", value = AadExternalSecuritySolution.class) +}) +@Immutable +public class ExternalSecuritySolutionInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ExternalSecuritySolutionInner.class); + + /* + * Location where the resource is stored + */ + @JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY) + private String location; + + /** + * Get the location property: Location where the resource is stored. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/InformationProtectionPolicyInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/InformationProtectionPolicyInner.java new file mode 100644 index 000000000000..58ffc98ba14f --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/InformationProtectionPolicyInner.java @@ -0,0 +1,133 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.models.InformationType; +import com.azure.resourcemanager.security.models.SensitivityLabel; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.Map; + +/** Information protection policy. */ +@JsonFlatten +@Fluent +public class InformationProtectionPolicyInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(InformationProtectionPolicyInner.class); + + /* + * Describes the last UTC time the policy was modified. + */ + @JsonProperty(value = "properties.lastModifiedUtc", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime lastModifiedUtc; + + /* + * Describes the version of the policy. + */ + @JsonProperty(value = "properties.version", access = JsonProperty.Access.WRITE_ONLY) + private String version; + + /* + * Dictionary of sensitivity labels. + */ + @JsonProperty(value = "properties.labels") + private Map labels; + + /* + * The sensitivity information types. + */ + @JsonProperty(value = "properties.informationTypes") + private Map informationTypes; + + /** + * Get the lastModifiedUtc property: Describes the last UTC time the policy was modified. + * + * @return the lastModifiedUtc value. + */ + public OffsetDateTime lastModifiedUtc() { + return this.lastModifiedUtc; + } + + /** + * Get the version property: Describes the version of the policy. + * + * @return the version value. + */ + public String version() { + return this.version; + } + + /** + * Get the labels property: Dictionary of sensitivity labels. + * + * @return the labels value. + */ + public Map labels() { + return this.labels; + } + + /** + * Set the labels property: Dictionary of sensitivity labels. + * + * @param labels the labels value to set. + * @return the InformationProtectionPolicyInner object itself. + */ + public InformationProtectionPolicyInner withLabels(Map labels) { + this.labels = labels; + return this; + } + + /** + * Get the informationTypes property: The sensitivity information types. + * + * @return the informationTypes value. + */ + public Map informationTypes() { + return this.informationTypes; + } + + /** + * Set the informationTypes property: The sensitivity information types. + * + * @param informationTypes the informationTypes value to set. + * @return the InformationProtectionPolicyInner object itself. + */ + public InformationProtectionPolicyInner withInformationTypes(Map informationTypes) { + this.informationTypes = informationTypes; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (labels() != null) { + labels() + .values() + .forEach( + e -> { + if (e != null) { + e.validate(); + } + }); + } + if (informationTypes() != null) { + informationTypes() + .values() + .forEach( + e -> { + if (e != null) { + e.validate(); + } + }); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/IngestionSettingInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/IngestionSettingInner.java new file mode 100644 index 000000000000..9d16c1149158 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/IngestionSettingInner.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Configures how to correlate scan data and logs with resources associated with the subscription. */ +@Fluent +public final class IngestionSettingInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(IngestionSettingInner.class); + + /* + * Ingestion setting data + */ + @JsonProperty(value = "properties") + private Object properties; + + /** + * Get the properties property: Ingestion setting data. + * + * @return the properties value. + */ + public Object properties() { + return this.properties; + } + + /** + * Set the properties property: Ingestion setting data. + * + * @param properties the properties value to set. + * @return the IngestionSettingInner object itself. + */ + public IngestionSettingInner withProperties(Object properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/IngestionSettingTokenInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/IngestionSettingTokenInner.java new file mode 100644 index 000000000000..0ccaf2285532 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/IngestionSettingTokenInner.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Configures how to correlate scan data and logs with resources associated with the subscription. */ +@Immutable +public final class IngestionSettingTokenInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(IngestionSettingTokenInner.class); + + /* + * The token is used for correlating security data and logs with the + * resources in the subscription. + */ + @JsonProperty(value = "token", access = JsonProperty.Access.WRITE_ONLY) + private String token; + + /** + * Get the token property: The token is used for correlating security data and logs with the resources in the + * subscription. + * + * @return the token value. + */ + public String token() { + return this.token; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/IoTSecurityAggregatedAlertInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/IoTSecurityAggregatedAlertInner.java new file mode 100644 index 000000000000..e63895b8af85 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/IoTSecurityAggregatedAlertInner.java @@ -0,0 +1,258 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.models.IoTSecurityAggregatedAlertPropertiesTopDevicesListItem; +import com.azure.resourcemanager.security.models.ReportedSeverity; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.LocalDate; +import java.util.List; +import java.util.Map; + +/** Security Solution Aggregated Alert information. */ +@JsonFlatten +@Fluent +public class IoTSecurityAggregatedAlertInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(IoTSecurityAggregatedAlertInner.class); + + /* + * Name of the alert type. + */ + @JsonProperty(value = "properties.alertType", access = JsonProperty.Access.WRITE_ONLY) + private String alertType; + + /* + * Display name of the alert type. + */ + @JsonProperty(value = "properties.alertDisplayName", access = JsonProperty.Access.WRITE_ONLY) + private String alertDisplayName; + + /* + * Date of detection. + */ + @JsonProperty(value = "properties.aggregatedDateUtc", access = JsonProperty.Access.WRITE_ONLY) + private LocalDate aggregatedDateUtc; + + /* + * Name of the organization that raised the alert. + */ + @JsonProperty(value = "properties.vendorName", access = JsonProperty.Access.WRITE_ONLY) + private String vendorName; + + /* + * Assessed alert severity. + */ + @JsonProperty(value = "properties.reportedSeverity", access = JsonProperty.Access.WRITE_ONLY) + private ReportedSeverity reportedSeverity; + + /* + * Recommended steps for remediation. + */ + @JsonProperty(value = "properties.remediationSteps", access = JsonProperty.Access.WRITE_ONLY) + private String remediationSteps; + + /* + * Description of the suspected vulnerability and meaning. + */ + @JsonProperty(value = "properties.description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /* + * Number of alerts occurrences within the aggregated time window. + */ + @JsonProperty(value = "properties.count", access = JsonProperty.Access.WRITE_ONLY) + private Long count; + + /* + * Azure resource ID of the resource that received the alerts. + */ + @JsonProperty(value = "properties.effectedResourceType", access = JsonProperty.Access.WRITE_ONLY) + private String effectedResourceType; + + /* + * The type of the alerted resource (Azure, Non-Azure). + */ + @JsonProperty(value = "properties.systemSource", access = JsonProperty.Access.WRITE_ONLY) + private String systemSource; + + /* + * IoT Security solution alert response. + */ + @JsonProperty(value = "properties.actionTaken", access = JsonProperty.Access.WRITE_ONLY) + private String actionTaken; + + /* + * Log analytics query for getting the list of affected devices/alerts. + */ + @JsonProperty(value = "properties.logAnalyticsQuery", access = JsonProperty.Access.WRITE_ONLY) + private String logAnalyticsQuery; + + /* + * 10 devices with the highest number of occurrences of this alert type, on + * this day. + */ + @JsonProperty(value = "properties.topDevicesList", access = JsonProperty.Access.WRITE_ONLY) + private List topDevicesList; + + /* + * Resource tags + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * Get the alertType property: Name of the alert type. + * + * @return the alertType value. + */ + public String alertType() { + return this.alertType; + } + + /** + * Get the alertDisplayName property: Display name of the alert type. + * + * @return the alertDisplayName value. + */ + public String alertDisplayName() { + return this.alertDisplayName; + } + + /** + * Get the aggregatedDateUtc property: Date of detection. + * + * @return the aggregatedDateUtc value. + */ + public LocalDate aggregatedDateUtc() { + return this.aggregatedDateUtc; + } + + /** + * Get the vendorName property: Name of the organization that raised the alert. + * + * @return the vendorName value. + */ + public String vendorName() { + return this.vendorName; + } + + /** + * Get the reportedSeverity property: Assessed alert severity. + * + * @return the reportedSeverity value. + */ + public ReportedSeverity reportedSeverity() { + return this.reportedSeverity; + } + + /** + * Get the remediationSteps property: Recommended steps for remediation. + * + * @return the remediationSteps value. + */ + public String remediationSteps() { + return this.remediationSteps; + } + + /** + * Get the description property: Description of the suspected vulnerability and meaning. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Get the count property: Number of alerts occurrences within the aggregated time window. + * + * @return the count value. + */ + public Long count() { + return this.count; + } + + /** + * Get the effectedResourceType property: Azure resource ID of the resource that received the alerts. + * + * @return the effectedResourceType value. + */ + public String effectedResourceType() { + return this.effectedResourceType; + } + + /** + * Get the systemSource property: The type of the alerted resource (Azure, Non-Azure). + * + * @return the systemSource value. + */ + public String systemSource() { + return this.systemSource; + } + + /** + * Get the actionTaken property: IoT Security solution alert response. + * + * @return the actionTaken value. + */ + public String actionTaken() { + return this.actionTaken; + } + + /** + * Get the logAnalyticsQuery property: Log analytics query for getting the list of affected devices/alerts. + * + * @return the logAnalyticsQuery value. + */ + public String logAnalyticsQuery() { + return this.logAnalyticsQuery; + } + + /** + * Get the topDevicesList property: 10 devices with the highest number of occurrences of this alert type, on this + * day. + * + * @return the topDevicesList value. + */ + public List topDevicesList() { + return this.topDevicesList; + } + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Resource tags. + * + * @param tags the tags value to set. + * @return the IoTSecurityAggregatedAlertInner object itself. + */ + public IoTSecurityAggregatedAlertInner withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (topDevicesList() != null) { + topDevicesList().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/IoTSecurityAggregatedRecommendationInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/IoTSecurityAggregatedRecommendationInner.java new file mode 100644 index 000000000000..c75f4c6ded38 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/IoTSecurityAggregatedRecommendationInner.java @@ -0,0 +1,216 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.models.ReportedSeverity; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** IoT Security solution recommendation information. */ +@JsonFlatten +@Fluent +public class IoTSecurityAggregatedRecommendationInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(IoTSecurityAggregatedRecommendationInner.class); + + /* + * Name of the recommendation. + */ + @JsonProperty(value = "properties.recommendationName") + private String recommendationName; + + /* + * Display name of the recommendation type. + */ + @JsonProperty(value = "properties.recommendationDisplayName", access = JsonProperty.Access.WRITE_ONLY) + private String recommendationDisplayName; + + /* + * Description of the suspected vulnerability and meaning. + */ + @JsonProperty(value = "properties.description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /* + * Recommendation-type GUID. + */ + @JsonProperty(value = "properties.recommendationTypeId", access = JsonProperty.Access.WRITE_ONLY) + private String recommendationTypeId; + + /* + * Name of the organization that made the recommendation. + */ + @JsonProperty(value = "properties.detectedBy", access = JsonProperty.Access.WRITE_ONLY) + private String detectedBy; + + /* + * Recommended steps for remediation + */ + @JsonProperty(value = "properties.remediationSteps", access = JsonProperty.Access.WRITE_ONLY) + private String remediationSteps; + + /* + * Assessed recommendation severity. + */ + @JsonProperty(value = "properties.reportedSeverity", access = JsonProperty.Access.WRITE_ONLY) + private ReportedSeverity reportedSeverity; + + /* + * Number of healthy devices within the IoT Security solution. + */ + @JsonProperty(value = "properties.healthyDevices", access = JsonProperty.Access.WRITE_ONLY) + private Long healthyDevices; + + /* + * Number of unhealthy devices within the IoT Security solution. + */ + @JsonProperty(value = "properties.unhealthyDeviceCount", access = JsonProperty.Access.WRITE_ONLY) + private Long unhealthyDeviceCount; + + /* + * Log analytics query for getting the list of affected devices/alerts. + */ + @JsonProperty(value = "properties.logAnalyticsQuery", access = JsonProperty.Access.WRITE_ONLY) + private String logAnalyticsQuery; + + /* + * Resource tags + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * Get the recommendationName property: Name of the recommendation. + * + * @return the recommendationName value. + */ + public String recommendationName() { + return this.recommendationName; + } + + /** + * Set the recommendationName property: Name of the recommendation. + * + * @param recommendationName the recommendationName value to set. + * @return the IoTSecurityAggregatedRecommendationInner object itself. + */ + public IoTSecurityAggregatedRecommendationInner withRecommendationName(String recommendationName) { + this.recommendationName = recommendationName; + return this; + } + + /** + * Get the recommendationDisplayName property: Display name of the recommendation type. + * + * @return the recommendationDisplayName value. + */ + public String recommendationDisplayName() { + return this.recommendationDisplayName; + } + + /** + * Get the description property: Description of the suspected vulnerability and meaning. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Get the recommendationTypeId property: Recommendation-type GUID. + * + * @return the recommendationTypeId value. + */ + public String recommendationTypeId() { + return this.recommendationTypeId; + } + + /** + * Get the detectedBy property: Name of the organization that made the recommendation. + * + * @return the detectedBy value. + */ + public String detectedBy() { + return this.detectedBy; + } + + /** + * Get the remediationSteps property: Recommended steps for remediation. + * + * @return the remediationSteps value. + */ + public String remediationSteps() { + return this.remediationSteps; + } + + /** + * Get the reportedSeverity property: Assessed recommendation severity. + * + * @return the reportedSeverity value. + */ + public ReportedSeverity reportedSeverity() { + return this.reportedSeverity; + } + + /** + * Get the healthyDevices property: Number of healthy devices within the IoT Security solution. + * + * @return the healthyDevices value. + */ + public Long healthyDevices() { + return this.healthyDevices; + } + + /** + * Get the unhealthyDeviceCount property: Number of unhealthy devices within the IoT Security solution. + * + * @return the unhealthyDeviceCount value. + */ + public Long unhealthyDeviceCount() { + return this.unhealthyDeviceCount; + } + + /** + * Get the logAnalyticsQuery property: Log analytics query for getting the list of affected devices/alerts. + * + * @return the logAnalyticsQuery value. + */ + public String logAnalyticsQuery() { + return this.logAnalyticsQuery; + } + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Resource tags. + * + * @param tags the tags value to set. + * @return the IoTSecurityAggregatedRecommendationInner object itself. + */ + public IoTSecurityAggregatedRecommendationInner withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/IoTSecuritySolutionAnalyticsModelInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/IoTSecuritySolutionAnalyticsModelInner.java new file mode 100644 index 000000000000..b4896011a2ce --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/IoTSecuritySolutionAnalyticsModelInner.java @@ -0,0 +1,174 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.models.IoTSecurityAlertedDevice; +import com.azure.resourcemanager.security.models.IoTSecurityDeviceAlert; +import com.azure.resourcemanager.security.models.IoTSecurityDeviceRecommendation; +import com.azure.resourcemanager.security.models.IoTSecuritySolutionAnalyticsModelPropertiesDevicesMetricsItem; +import com.azure.resourcemanager.security.models.IoTSeverityMetrics; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Security analytics of your IoT Security solution. */ +@JsonFlatten +@Fluent +public class IoTSecuritySolutionAnalyticsModelInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(IoTSecuritySolutionAnalyticsModelInner.class); + + /* + * Security analytics of your IoT Security solution. + */ + @JsonProperty(value = "properties.metrics", access = JsonProperty.Access.WRITE_ONLY) + private IoTSeverityMetrics metrics; + + /* + * Number of unhealthy devices within your IoT Security solution. + */ + @JsonProperty(value = "properties.unhealthyDeviceCount", access = JsonProperty.Access.WRITE_ONLY) + private Long unhealthyDeviceCount; + + /* + * List of device metrics by the aggregation date. + */ + @JsonProperty(value = "properties.devicesMetrics", access = JsonProperty.Access.WRITE_ONLY) + private List devicesMetrics; + + /* + * List of the 3 devices with the most alerts. + */ + @JsonProperty(value = "properties.topAlertedDevices") + private List topAlertedDevices; + + /* + * List of the 3 most prevalent device alerts. + */ + @JsonProperty(value = "properties.mostPrevalentDeviceAlerts") + private List mostPrevalentDeviceAlerts; + + /* + * List of the 3 most prevalent device recommendations. + */ + @JsonProperty(value = "properties.mostPrevalentDeviceRecommendations") + private List mostPrevalentDeviceRecommendations; + + /** + * Get the metrics property: Security analytics of your IoT Security solution. + * + * @return the metrics value. + */ + public IoTSeverityMetrics metrics() { + return this.metrics; + } + + /** + * Get the unhealthyDeviceCount property: Number of unhealthy devices within your IoT Security solution. + * + * @return the unhealthyDeviceCount value. + */ + public Long unhealthyDeviceCount() { + return this.unhealthyDeviceCount; + } + + /** + * Get the devicesMetrics property: List of device metrics by the aggregation date. + * + * @return the devicesMetrics value. + */ + public List devicesMetrics() { + return this.devicesMetrics; + } + + /** + * Get the topAlertedDevices property: List of the 3 devices with the most alerts. + * + * @return the topAlertedDevices value. + */ + public List topAlertedDevices() { + return this.topAlertedDevices; + } + + /** + * Set the topAlertedDevices property: List of the 3 devices with the most alerts. + * + * @param topAlertedDevices the topAlertedDevices value to set. + * @return the IoTSecuritySolutionAnalyticsModelInner object itself. + */ + public IoTSecuritySolutionAnalyticsModelInner withTopAlertedDevices( + List topAlertedDevices) { + this.topAlertedDevices = topAlertedDevices; + return this; + } + + /** + * Get the mostPrevalentDeviceAlerts property: List of the 3 most prevalent device alerts. + * + * @return the mostPrevalentDeviceAlerts value. + */ + public List mostPrevalentDeviceAlerts() { + return this.mostPrevalentDeviceAlerts; + } + + /** + * Set the mostPrevalentDeviceAlerts property: List of the 3 most prevalent device alerts. + * + * @param mostPrevalentDeviceAlerts the mostPrevalentDeviceAlerts value to set. + * @return the IoTSecuritySolutionAnalyticsModelInner object itself. + */ + public IoTSecuritySolutionAnalyticsModelInner withMostPrevalentDeviceAlerts( + List mostPrevalentDeviceAlerts) { + this.mostPrevalentDeviceAlerts = mostPrevalentDeviceAlerts; + return this; + } + + /** + * Get the mostPrevalentDeviceRecommendations property: List of the 3 most prevalent device recommendations. + * + * @return the mostPrevalentDeviceRecommendations value. + */ + public List mostPrevalentDeviceRecommendations() { + return this.mostPrevalentDeviceRecommendations; + } + + /** + * Set the mostPrevalentDeviceRecommendations property: List of the 3 most prevalent device recommendations. + * + * @param mostPrevalentDeviceRecommendations the mostPrevalentDeviceRecommendations value to set. + * @return the IoTSecuritySolutionAnalyticsModelInner object itself. + */ + public IoTSecuritySolutionAnalyticsModelInner withMostPrevalentDeviceRecommendations( + List mostPrevalentDeviceRecommendations) { + this.mostPrevalentDeviceRecommendations = mostPrevalentDeviceRecommendations; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (metrics() != null) { + metrics().validate(); + } + if (devicesMetrics() != null) { + devicesMetrics().forEach(e -> e.validate()); + } + if (topAlertedDevices() != null) { + topAlertedDevices().forEach(e -> e.validate()); + } + if (mostPrevalentDeviceAlerts() != null) { + mostPrevalentDeviceAlerts().forEach(e -> e.validate()); + } + if (mostPrevalentDeviceRecommendations() != null) { + mostPrevalentDeviceRecommendations().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/IoTSecuritySolutionAnalyticsModelListInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/IoTSecuritySolutionAnalyticsModelListInner.java new file mode 100644 index 000000000000..5176830d9ffe --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/IoTSecuritySolutionAnalyticsModelListInner.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of Security analytics of your IoT Security solution. */ +@Fluent +public final class IoTSecuritySolutionAnalyticsModelListInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(IoTSecuritySolutionAnalyticsModelListInner.class); + + /* + * List of Security analytics of your IoT Security solution + */ + @JsonProperty(value = "value", required = true) + private List value; + + /* + * When there is too much alert data for one page, use this URI to fetch + * the next page. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: List of Security analytics of your IoT Security solution. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: List of Security analytics of your IoT Security solution. + * + * @param value the value value to set. + * @return the IoTSecuritySolutionAnalyticsModelListInner object itself. + */ + public IoTSecuritySolutionAnalyticsModelListInner withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: When there is too much alert data for one page, use this URI to fetch the next page. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property value in model IoTSecuritySolutionAnalyticsModelListInner")); + } else { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/IoTSecuritySolutionModelInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/IoTSecuritySolutionModelInner.java new file mode 100644 index 000000000000..b4fba2e83a4b --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/IoTSecuritySolutionModelInner.java @@ -0,0 +1,394 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.models.AdditionalWorkspacesProperties; +import com.azure.resourcemanager.security.models.DataSource; +import com.azure.resourcemanager.security.models.ExportData; +import com.azure.resourcemanager.security.models.RecommendationConfigurationProperties; +import com.azure.resourcemanager.security.models.SecuritySolutionStatus; +import com.azure.resourcemanager.security.models.UnmaskedIpLoggingStatus; +import com.azure.resourcemanager.security.models.UserDefinedResourcesProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** IoT Security solution configuration and resource information. */ +@JsonFlatten +@Fluent +public class IoTSecuritySolutionModelInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(IoTSecuritySolutionModelInner.class); + + /* + * The resource location. + */ + @JsonProperty(value = "location") + private String location; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy + * information. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /* + * Workspace resource ID + */ + @JsonProperty(value = "properties.workspace") + private String workspace; + + /* + * Resource display name. + */ + @JsonProperty(value = "properties.displayName") + private String displayName; + + /* + * Status of the IoT Security solution. + */ + @JsonProperty(value = "properties.status") + private SecuritySolutionStatus status; + + /* + * List of additional options for exporting to workspace data. + */ + @JsonProperty(value = "properties.export") + private List export; + + /* + * Disabled data sources. Disabling these data sources compromises the + * system. + */ + @JsonProperty(value = "properties.disabledDataSources") + private List disabledDataSources; + + /* + * IoT Hub resource IDs + */ + @JsonProperty(value = "properties.iotHubs") + private List iotHubs; + + /* + * Properties of the IoT Security solution's user defined resources. + */ + @JsonProperty(value = "properties.userDefinedResources") + private UserDefinedResourcesProperties userDefinedResources; + + /* + * List of resources that were automatically discovered as relevant to the + * security solution. + */ + @JsonProperty(value = "properties.autoDiscoveredResources", access = JsonProperty.Access.WRITE_ONLY) + private List autoDiscoveredResources; + + /* + * List of the configuration status for each recommendation type. + */ + @JsonProperty(value = "properties.recommendationsConfiguration") + private List recommendationsConfiguration; + + /* + * Unmasked IP address logging status + */ + @JsonProperty(value = "properties.unmaskedIpLoggingStatus") + private UnmaskedIpLoggingStatus unmaskedIpLoggingStatus; + + /* + * List of additional workspaces + */ + @JsonProperty(value = "properties.additionalWorkspaces") + private List additionalWorkspaces; + + /* + * Resource tags + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * Get the location property: The resource location. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: The resource location. + * + * @param location the location value to set. + * @return the IoTSecuritySolutionModelInner object itself. + */ + public IoTSecuritySolutionModelInner withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the workspace property: Workspace resource ID. + * + * @return the workspace value. + */ + public String workspace() { + return this.workspace; + } + + /** + * Set the workspace property: Workspace resource ID. + * + * @param workspace the workspace value to set. + * @return the IoTSecuritySolutionModelInner object itself. + */ + public IoTSecuritySolutionModelInner withWorkspace(String workspace) { + this.workspace = workspace; + return this; + } + + /** + * Get the displayName property: Resource display name. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName property: Resource display name. + * + * @param displayName the displayName value to set. + * @return the IoTSecuritySolutionModelInner object itself. + */ + public IoTSecuritySolutionModelInner withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the status property: Status of the IoT Security solution. + * + * @return the status value. + */ + public SecuritySolutionStatus status() { + return this.status; + } + + /** + * Set the status property: Status of the IoT Security solution. + * + * @param status the status value to set. + * @return the IoTSecuritySolutionModelInner object itself. + */ + public IoTSecuritySolutionModelInner withStatus(SecuritySolutionStatus status) { + this.status = status; + return this; + } + + /** + * Get the export property: List of additional options for exporting to workspace data. + * + * @return the export value. + */ + public List export() { + return this.export; + } + + /** + * Set the export property: List of additional options for exporting to workspace data. + * + * @param export the export value to set. + * @return the IoTSecuritySolutionModelInner object itself. + */ + public IoTSecuritySolutionModelInner withExport(List export) { + this.export = export; + return this; + } + + /** + * Get the disabledDataSources property: Disabled data sources. Disabling these data sources compromises the system. + * + * @return the disabledDataSources value. + */ + public List disabledDataSources() { + return this.disabledDataSources; + } + + /** + * Set the disabledDataSources property: Disabled data sources. Disabling these data sources compromises the system. + * + * @param disabledDataSources the disabledDataSources value to set. + * @return the IoTSecuritySolutionModelInner object itself. + */ + public IoTSecuritySolutionModelInner withDisabledDataSources(List disabledDataSources) { + this.disabledDataSources = disabledDataSources; + return this; + } + + /** + * Get the iotHubs property: IoT Hub resource IDs. + * + * @return the iotHubs value. + */ + public List iotHubs() { + return this.iotHubs; + } + + /** + * Set the iotHubs property: IoT Hub resource IDs. + * + * @param iotHubs the iotHubs value to set. + * @return the IoTSecuritySolutionModelInner object itself. + */ + public IoTSecuritySolutionModelInner withIotHubs(List iotHubs) { + this.iotHubs = iotHubs; + return this; + } + + /** + * Get the userDefinedResources property: Properties of the IoT Security solution's user defined resources. + * + * @return the userDefinedResources value. + */ + public UserDefinedResourcesProperties userDefinedResources() { + return this.userDefinedResources; + } + + /** + * Set the userDefinedResources property: Properties of the IoT Security solution's user defined resources. + * + * @param userDefinedResources the userDefinedResources value to set. + * @return the IoTSecuritySolutionModelInner object itself. + */ + public IoTSecuritySolutionModelInner withUserDefinedResources(UserDefinedResourcesProperties userDefinedResources) { + this.userDefinedResources = userDefinedResources; + return this; + } + + /** + * Get the autoDiscoveredResources property: List of resources that were automatically discovered as relevant to the + * security solution. + * + * @return the autoDiscoveredResources value. + */ + public List autoDiscoveredResources() { + return this.autoDiscoveredResources; + } + + /** + * Get the recommendationsConfiguration property: List of the configuration status for each recommendation type. + * + * @return the recommendationsConfiguration value. + */ + public List recommendationsConfiguration() { + return this.recommendationsConfiguration; + } + + /** + * Set the recommendationsConfiguration property: List of the configuration status for each recommendation type. + * + * @param recommendationsConfiguration the recommendationsConfiguration value to set. + * @return the IoTSecuritySolutionModelInner object itself. + */ + public IoTSecuritySolutionModelInner withRecommendationsConfiguration( + List recommendationsConfiguration) { + this.recommendationsConfiguration = recommendationsConfiguration; + return this; + } + + /** + * Get the unmaskedIpLoggingStatus property: Unmasked IP address logging status. + * + * @return the unmaskedIpLoggingStatus value. + */ + public UnmaskedIpLoggingStatus unmaskedIpLoggingStatus() { + return this.unmaskedIpLoggingStatus; + } + + /** + * Set the unmaskedIpLoggingStatus property: Unmasked IP address logging status. + * + * @param unmaskedIpLoggingStatus the unmaskedIpLoggingStatus value to set. + * @return the IoTSecuritySolutionModelInner object itself. + */ + public IoTSecuritySolutionModelInner withUnmaskedIpLoggingStatus(UnmaskedIpLoggingStatus unmaskedIpLoggingStatus) { + this.unmaskedIpLoggingStatus = unmaskedIpLoggingStatus; + return this; + } + + /** + * Get the additionalWorkspaces property: List of additional workspaces. + * + * @return the additionalWorkspaces value. + */ + public List additionalWorkspaces() { + return this.additionalWorkspaces; + } + + /** + * Set the additionalWorkspaces property: List of additional workspaces. + * + * @param additionalWorkspaces the additionalWorkspaces value to set. + * @return the IoTSecuritySolutionModelInner object itself. + */ + public IoTSecuritySolutionModelInner withAdditionalWorkspaces( + List additionalWorkspaces) { + this.additionalWorkspaces = additionalWorkspaces; + return this; + } + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Resource tags. + * + * @param tags the tags value to set. + * @return the IoTSecuritySolutionModelInner object itself. + */ + public IoTSecuritySolutionModelInner withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (userDefinedResources() != null) { + userDefinedResources().validate(); + } + if (recommendationsConfiguration() != null) { + recommendationsConfiguration().forEach(e -> e.validate()); + } + if (additionalWorkspaces() != null) { + additionalWorkspaces().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/IotAlertModelInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/IotAlertModelInner.java new file mode 100644 index 000000000000..f6fe3964e991 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/IotAlertModelInner.java @@ -0,0 +1,161 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** IoT alert. */ +@JsonFlatten +@Fluent +public class IotAlertModelInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(IotAlertModelInner.class); + + /* + * Holds the product canonical identifier of the alert within the scope of + * a product + */ + @JsonProperty(value = "properties.systemAlertId", access = JsonProperty.Access.WRITE_ONLY) + private String systemAlertId; + + /* + * Display name of the main entity being reported on + */ + @JsonProperty(value = "properties.compromisedEntity", access = JsonProperty.Access.WRITE_ONLY) + private String compromisedEntity; + + /* + * The type name of the alert + */ + @JsonProperty(value = "properties.alertType", access = JsonProperty.Access.WRITE_ONLY) + private String alertType; + + /* + * The impact start time of the alert (the time of the first event or + * activity included in the alert) + */ + @JsonProperty(value = "properties.startTimeUtc", access = JsonProperty.Access.WRITE_ONLY) + private String startTimeUtc; + + /* + * The impact end time of the alert (the time of the last event or activity + * included in the alert) + */ + @JsonProperty(value = "properties.endTimeUtc", access = JsonProperty.Access.WRITE_ONLY) + private String endTimeUtc; + + /* + * A list of entities related to the alert + */ + @JsonProperty(value = "properties.entities") + private List entities; + + /* + * A bag of fields which extends the alert information + */ + @JsonProperty(value = "properties.extendedProperties") + private Object extendedProperties; + + /** + * Get the systemAlertId property: Holds the product canonical identifier of the alert within the scope of a + * product. + * + * @return the systemAlertId value. + */ + public String systemAlertId() { + return this.systemAlertId; + } + + /** + * Get the compromisedEntity property: Display name of the main entity being reported on. + * + * @return the compromisedEntity value. + */ + public String compromisedEntity() { + return this.compromisedEntity; + } + + /** + * Get the alertType property: The type name of the alert. + * + * @return the alertType value. + */ + public String alertType() { + return this.alertType; + } + + /** + * Get the startTimeUtc property: The impact start time of the alert (the time of the first event or activity + * included in the alert). + * + * @return the startTimeUtc value. + */ + public String startTimeUtc() { + return this.startTimeUtc; + } + + /** + * Get the endTimeUtc property: The impact end time of the alert (the time of the last event or activity included in + * the alert). + * + * @return the endTimeUtc value. + */ + public String endTimeUtc() { + return this.endTimeUtc; + } + + /** + * Get the entities property: A list of entities related to the alert. + * + * @return the entities value. + */ + public List entities() { + return this.entities; + } + + /** + * Set the entities property: A list of entities related to the alert. + * + * @param entities the entities value to set. + * @return the IotAlertModelInner object itself. + */ + public IotAlertModelInner withEntities(List entities) { + this.entities = entities; + return this; + } + + /** + * Get the extendedProperties property: A bag of fields which extends the alert information. + * + * @return the extendedProperties value. + */ + public Object extendedProperties() { + return this.extendedProperties; + } + + /** + * Set the extendedProperties property: A bag of fields which extends the alert information. + * + * @param extendedProperties the extendedProperties value to set. + * @return the IotAlertModelInner object itself. + */ + public IotAlertModelInner withExtendedProperties(Object extendedProperties) { + this.extendedProperties = extendedProperties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/IotAlertTypeInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/IotAlertTypeInner.java new file mode 100644 index 000000000000..180a9cf7a0bb --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/IotAlertTypeInner.java @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.models.AlertIntent; +import com.azure.resourcemanager.security.models.AlertSeverity; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** IoT alert type. */ +@JsonFlatten +@Immutable +public class IotAlertTypeInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(IotAlertTypeInner.class); + + /* + * The display name of the alert + */ + @JsonProperty(value = "properties.alertDisplayName", access = JsonProperty.Access.WRITE_ONLY) + private String alertDisplayName; + + /* + * The severity of the alert + */ + @JsonProperty(value = "properties.severity", access = JsonProperty.Access.WRITE_ONLY) + private AlertSeverity severity; + + /* + * Description of the suspected vulnerability and meaning. + */ + @JsonProperty(value = "properties.description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /* + * The name of the alert provider or internal partner + */ + @JsonProperty(value = "properties.providerName", access = JsonProperty.Access.WRITE_ONLY) + private String providerName; + + /* + * The name of the product which published this alert + */ + @JsonProperty(value = "properties.productName", access = JsonProperty.Access.WRITE_ONLY) + private String productName; + + /* + * The name of a component inside the product which generated the alert + */ + @JsonProperty(value = "properties.productComponentName", access = JsonProperty.Access.WRITE_ONLY) + private String productComponentName; + + /* + * The name of the vendor that raise the alert + */ + @JsonProperty(value = "properties.vendorName", access = JsonProperty.Access.WRITE_ONLY) + private String vendorName; + + /* + * Kill chain related intent behind the alert. Could contain multiple enum + * values (separated by commas) + */ + @JsonProperty(value = "properties.intent", access = JsonProperty.Access.WRITE_ONLY) + private AlertIntent intent; + + /* + * Manual action items to take to remediate the alert + */ + @JsonProperty(value = "properties.remediationSteps", access = JsonProperty.Access.WRITE_ONLY) + private List remediationSteps; + + /** + * Get the alertDisplayName property: The display name of the alert. + * + * @return the alertDisplayName value. + */ + public String alertDisplayName() { + return this.alertDisplayName; + } + + /** + * Get the severity property: The severity of the alert. + * + * @return the severity value. + */ + public AlertSeverity severity() { + return this.severity; + } + + /** + * Get the description property: Description of the suspected vulnerability and meaning. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Get the providerName property: The name of the alert provider or internal partner. + * + * @return the providerName value. + */ + public String providerName() { + return this.providerName; + } + + /** + * Get the productName property: The name of the product which published this alert. + * + * @return the productName value. + */ + public String productName() { + return this.productName; + } + + /** + * Get the productComponentName property: The name of a component inside the product which generated the alert. + * + * @return the productComponentName value. + */ + public String productComponentName() { + return this.productComponentName; + } + + /** + * Get the vendorName property: The name of the vendor that raise the alert. + * + * @return the vendorName value. + */ + public String vendorName() { + return this.vendorName; + } + + /** + * Get the intent property: Kill chain related intent behind the alert. Could contain multiple enum values + * (separated by commas). + * + * @return the intent value. + */ + public AlertIntent intent() { + return this.intent; + } + + /** + * Get the remediationSteps property: Manual action items to take to remediate the alert. + * + * @return the remediationSteps value. + */ + public List remediationSteps() { + return this.remediationSteps; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/IotAlertTypeListInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/IotAlertTypeListInner.java new file mode 100644 index 000000000000..d428d8283f9a --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/IotAlertTypeListInner.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of alert types. */ +@Fluent +public final class IotAlertTypeListInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(IotAlertTypeListInner.class); + + /* + * List data + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the value property: List data. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: List data. + * + * @param value the value value to set. + * @return the IotAlertTypeListInner object itself. + */ + public IotAlertTypeListInner withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/IotDefenderSettingsListInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/IotDefenderSettingsListInner.java new file mode 100644 index 000000000000..26fb0a90bee1 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/IotDefenderSettingsListInner.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of IoT Defender settings. */ +@Immutable +public final class IotDefenderSettingsListInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(IotDefenderSettingsListInner.class); + + /* + * List data + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /** + * Get the value property: List data. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/IotDefenderSettingsModelInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/IotDefenderSettingsModelInner.java new file mode 100644 index 000000000000..0619dc3c8394 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/IotDefenderSettingsModelInner.java @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.models.OnboardingKind; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** IoT Defender settings. */ +@JsonFlatten +@Fluent +public class IotDefenderSettingsModelInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(IotDefenderSettingsModelInner.class); + + /* + * Size of the device quota (as a opposed to a Pay as You Go billing + * model). Value is required to be in multiples of 1000. + */ + @JsonProperty(value = "properties.deviceQuota") + private Integer deviceQuota; + + /* + * Sentinel Workspace Resource Ids + */ + @JsonProperty(value = "properties.sentinelWorkspaceResourceIds") + private List sentinelWorkspaceResourceIds; + + /* + * The kind of onboarding for the subscription + */ + @JsonProperty(value = "properties.onboardingKind") + private OnboardingKind onboardingKind; + + /* + * End time of the evaluation period, if such exist + */ + @JsonProperty(value = "properties.evaluationEndTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime evaluationEndTime; + + /** + * Get the deviceQuota property: Size of the device quota (as a opposed to a Pay as You Go billing model). Value is + * required to be in multiples of 1000. + * + * @return the deviceQuota value. + */ + public Integer deviceQuota() { + return this.deviceQuota; + } + + /** + * Set the deviceQuota property: Size of the device quota (as a opposed to a Pay as You Go billing model). Value is + * required to be in multiples of 1000. + * + * @param deviceQuota the deviceQuota value to set. + * @return the IotDefenderSettingsModelInner object itself. + */ + public IotDefenderSettingsModelInner withDeviceQuota(Integer deviceQuota) { + this.deviceQuota = deviceQuota; + return this; + } + + /** + * Get the sentinelWorkspaceResourceIds property: Sentinel Workspace Resource Ids. + * + * @return the sentinelWorkspaceResourceIds value. + */ + public List sentinelWorkspaceResourceIds() { + return this.sentinelWorkspaceResourceIds; + } + + /** + * Set the sentinelWorkspaceResourceIds property: Sentinel Workspace Resource Ids. + * + * @param sentinelWorkspaceResourceIds the sentinelWorkspaceResourceIds value to set. + * @return the IotDefenderSettingsModelInner object itself. + */ + public IotDefenderSettingsModelInner withSentinelWorkspaceResourceIds(List sentinelWorkspaceResourceIds) { + this.sentinelWorkspaceResourceIds = sentinelWorkspaceResourceIds; + return this; + } + + /** + * Get the onboardingKind property: The kind of onboarding for the subscription. + * + * @return the onboardingKind value. + */ + public OnboardingKind onboardingKind() { + return this.onboardingKind; + } + + /** + * Set the onboardingKind property: The kind of onboarding for the subscription. + * + * @param onboardingKind the onboardingKind value to set. + * @return the IotDefenderSettingsModelInner object itself. + */ + public IotDefenderSettingsModelInner withOnboardingKind(OnboardingKind onboardingKind) { + this.onboardingKind = onboardingKind; + return this; + } + + /** + * Get the evaluationEndTime property: End time of the evaluation period, if such exist. + * + * @return the evaluationEndTime value. + */ + public OffsetDateTime evaluationEndTime() { + return this.evaluationEndTime; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/IotRecommendationModelInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/IotRecommendationModelInner.java new file mode 100644 index 000000000000..b094b7940c0c --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/IotRecommendationModelInner.java @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** IoT recommendation. */ +@JsonFlatten +@Fluent +public class IotRecommendationModelInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(IotRecommendationModelInner.class); + + /* + * Identifier of the device being reported on + */ + @JsonProperty(value = "properties.deviceId", access = JsonProperty.Access.WRITE_ONLY) + private String deviceId; + + /* + * The type name of the recommendation + */ + @JsonProperty(value = "properties.recommendationType", access = JsonProperty.Access.WRITE_ONLY) + private String recommendationType; + + /* + * The discovery time of the recommendation + */ + @JsonProperty(value = "properties.discoveredTimeUtc", access = JsonProperty.Access.WRITE_ONLY) + private String discoveredTimeUtc; + + /* + * A bag of fields which extends the recommendation information + */ + @JsonProperty(value = "properties.recommendationAdditionalData") + private Object recommendationAdditionalData; + + /** + * Get the deviceId property: Identifier of the device being reported on. + * + * @return the deviceId value. + */ + public String deviceId() { + return this.deviceId; + } + + /** + * Get the recommendationType property: The type name of the recommendation. + * + * @return the recommendationType value. + */ + public String recommendationType() { + return this.recommendationType; + } + + /** + * Get the discoveredTimeUtc property: The discovery time of the recommendation. + * + * @return the discoveredTimeUtc value. + */ + public String discoveredTimeUtc() { + return this.discoveredTimeUtc; + } + + /** + * Get the recommendationAdditionalData property: A bag of fields which extends the recommendation information. + * + * @return the recommendationAdditionalData value. + */ + public Object recommendationAdditionalData() { + return this.recommendationAdditionalData; + } + + /** + * Set the recommendationAdditionalData property: A bag of fields which extends the recommendation information. + * + * @param recommendationAdditionalData the recommendationAdditionalData value to set. + * @return the IotRecommendationModelInner object itself. + */ + public IotRecommendationModelInner withRecommendationAdditionalData(Object recommendationAdditionalData) { + this.recommendationAdditionalData = recommendationAdditionalData; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/IotRecommendationTypeInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/IotRecommendationTypeInner.java new file mode 100644 index 000000000000..eaca53fa1320 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/IotRecommendationTypeInner.java @@ -0,0 +1,166 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.models.RecommendationSeverity; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** IoT recommendation type. */ +@JsonFlatten +@Immutable +public class IotRecommendationTypeInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(IotRecommendationTypeInner.class); + + /* + * The display name of the recommendation + */ + @JsonProperty(value = "properties.recommendationDisplayName", access = JsonProperty.Access.WRITE_ONLY) + private String recommendationDisplayName; + + /* + * The severity of the recommendation + */ + @JsonProperty(value = "properties.severity", access = JsonProperty.Access.WRITE_ONLY) + private RecommendationSeverity severity; + + /* + * Description of the suspected vulnerability and meaning. + */ + @JsonProperty(value = "properties.description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /* + * The name of the product which published this recommendation + */ + @JsonProperty(value = "properties.productName", access = JsonProperty.Access.WRITE_ONLY) + private String productName; + + /* + * The name of a component inside the product which generated the + * recommendation + */ + @JsonProperty(value = "properties.productComponentName", access = JsonProperty.Access.WRITE_ONLY) + private String productComponentName; + + /* + * The name of the vendor that raised the recommendation + */ + @JsonProperty(value = "properties.vendorName", access = JsonProperty.Access.WRITE_ONLY) + private String vendorName; + + /* + * The name of the recommendation's control category + */ + @JsonProperty(value = "properties.control", access = JsonProperty.Access.WRITE_ONLY) + private String control; + + /* + * Manual action items to take to resolve the recommendation + */ + @JsonProperty(value = "properties.remediationSteps", access = JsonProperty.Access.WRITE_ONLY) + private List remediationSteps; + + /* + * The alert's data source + */ + @JsonProperty(value = "properties.dataSource", access = JsonProperty.Access.WRITE_ONLY) + private String dataSource; + + /** + * Get the recommendationDisplayName property: The display name of the recommendation. + * + * @return the recommendationDisplayName value. + */ + public String recommendationDisplayName() { + return this.recommendationDisplayName; + } + + /** + * Get the severity property: The severity of the recommendation. + * + * @return the severity value. + */ + public RecommendationSeverity severity() { + return this.severity; + } + + /** + * Get the description property: Description of the suspected vulnerability and meaning. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Get the productName property: The name of the product which published this recommendation. + * + * @return the productName value. + */ + public String productName() { + return this.productName; + } + + /** + * Get the productComponentName property: The name of a component inside the product which generated the + * recommendation. + * + * @return the productComponentName value. + */ + public String productComponentName() { + return this.productComponentName; + } + + /** + * Get the vendorName property: The name of the vendor that raised the recommendation. + * + * @return the vendorName value. + */ + public String vendorName() { + return this.vendorName; + } + + /** + * Get the control property: The name of the recommendation's control category. + * + * @return the control value. + */ + public String control() { + return this.control; + } + + /** + * Get the remediationSteps property: Manual action items to take to resolve the recommendation. + * + * @return the remediationSteps value. + */ + public List remediationSteps() { + return this.remediationSteps; + } + + /** + * Get the dataSource property: The alert's data source. + * + * @return the dataSource value. + */ + public String dataSource() { + return this.dataSource; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/IotRecommendationTypeListInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/IotRecommendationTypeListInner.java new file mode 100644 index 000000000000..72028c184a28 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/IotRecommendationTypeListInner.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of recommendation types. */ +@Fluent +public final class IotRecommendationTypeListInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(IotRecommendationTypeListInner.class); + + /* + * List data + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the value property: List data. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: List data. + * + * @param value the value value to set. + * @return the IotRecommendationTypeListInner object itself. + */ + public IotRecommendationTypeListInner withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/IotSensorsListInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/IotSensorsListInner.java new file mode 100644 index 000000000000..94c2c0fe00ed --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/IotSensorsListInner.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of IoT sensors. */ +@Immutable +public final class IotSensorsListInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(IotSensorsListInner.class); + + /* + * List data + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /** + * Get the value property: List data. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/IotSensorsModelInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/IotSensorsModelInner.java new file mode 100644 index 000000000000..b29eeacb9c94 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/IotSensorsModelInner.java @@ -0,0 +1,228 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.models.SensorStatus; +import com.azure.resourcemanager.security.models.SensorType; +import com.azure.resourcemanager.security.models.TiStatus; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** IoT sensor model. */ +@JsonFlatten +@Fluent +public class IotSensorsModelInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(IotSensorsModelInner.class); + + /* + * Last connectivity time of the IoT sensor + */ + @JsonProperty(value = "properties.connectivityTime", access = JsonProperty.Access.WRITE_ONLY) + private String connectivityTime; + + /* + * Creation time of the IoT sensor + */ + @JsonProperty(value = "properties.creationTime", access = JsonProperty.Access.WRITE_ONLY) + private String creationTime; + + /* + * Dynamic mode status of the IoT sensor + */ + @JsonProperty(value = "properties.dynamicLearning", access = JsonProperty.Access.WRITE_ONLY) + private Boolean dynamicLearning; + + /* + * Learning mode status of the IoT sensor + */ + @JsonProperty(value = "properties.learningMode", access = JsonProperty.Access.WRITE_ONLY) + private Boolean learningMode; + + /* + * Status of the IoT sensor + */ + @JsonProperty(value = "properties.sensorStatus", access = JsonProperty.Access.WRITE_ONLY) + private SensorStatus sensorStatus; + + /* + * Version of the IoT sensor + */ + @JsonProperty(value = "properties.sensorVersion", access = JsonProperty.Access.WRITE_ONLY) + private String sensorVersion; + + /* + * TI Automatic mode status of the IoT sensor + */ + @JsonProperty(value = "properties.tiAutomaticUpdates") + private Boolean tiAutomaticUpdates; + + /* + * TI Status of the IoT sensor + */ + @JsonProperty(value = "properties.tiStatus", access = JsonProperty.Access.WRITE_ONLY) + private TiStatus tiStatus; + + /* + * TI Version of the IoT sensor + */ + @JsonProperty(value = "properties.tiVersion", access = JsonProperty.Access.WRITE_ONLY) + private String tiVersion; + + /* + * Zone of the IoT sensor + */ + @JsonProperty(value = "properties.zone") + private String zone; + + /* + * Type of sensor + */ + @JsonProperty(value = "properties.sensorType") + private SensorType sensorType; + + /** + * Get the connectivityTime property: Last connectivity time of the IoT sensor. + * + * @return the connectivityTime value. + */ + public String connectivityTime() { + return this.connectivityTime; + } + + /** + * Get the creationTime property: Creation time of the IoT sensor. + * + * @return the creationTime value. + */ + public String creationTime() { + return this.creationTime; + } + + /** + * Get the dynamicLearning property: Dynamic mode status of the IoT sensor. + * + * @return the dynamicLearning value. + */ + public Boolean dynamicLearning() { + return this.dynamicLearning; + } + + /** + * Get the learningMode property: Learning mode status of the IoT sensor. + * + * @return the learningMode value. + */ + public Boolean learningMode() { + return this.learningMode; + } + + /** + * Get the sensorStatus property: Status of the IoT sensor. + * + * @return the sensorStatus value. + */ + public SensorStatus sensorStatus() { + return this.sensorStatus; + } + + /** + * Get the sensorVersion property: Version of the IoT sensor. + * + * @return the sensorVersion value. + */ + public String sensorVersion() { + return this.sensorVersion; + } + + /** + * Get the tiAutomaticUpdates property: TI Automatic mode status of the IoT sensor. + * + * @return the tiAutomaticUpdates value. + */ + public Boolean tiAutomaticUpdates() { + return this.tiAutomaticUpdates; + } + + /** + * Set the tiAutomaticUpdates property: TI Automatic mode status of the IoT sensor. + * + * @param tiAutomaticUpdates the tiAutomaticUpdates value to set. + * @return the IotSensorsModelInner object itself. + */ + public IotSensorsModelInner withTiAutomaticUpdates(Boolean tiAutomaticUpdates) { + this.tiAutomaticUpdates = tiAutomaticUpdates; + return this; + } + + /** + * Get the tiStatus property: TI Status of the IoT sensor. + * + * @return the tiStatus value. + */ + public TiStatus tiStatus() { + return this.tiStatus; + } + + /** + * Get the tiVersion property: TI Version of the IoT sensor. + * + * @return the tiVersion value. + */ + public String tiVersion() { + return this.tiVersion; + } + + /** + * Get the zone property: Zone of the IoT sensor. + * + * @return the zone value. + */ + public String zone() { + return this.zone; + } + + /** + * Set the zone property: Zone of the IoT sensor. + * + * @param zone the zone value to set. + * @return the IotSensorsModelInner object itself. + */ + public IotSensorsModelInner withZone(String zone) { + this.zone = zone; + return this; + } + + /** + * Get the sensorType property: Type of sensor. + * + * @return the sensorType value. + */ + public SensorType sensorType() { + return this.sensorType; + } + + /** + * Set the sensorType property: Type of sensor. + * + * @param sensorType the sensorType value to set. + * @return the IotSensorsModelInner object itself. + */ + public IotSensorsModelInner withSensorType(SensorType sensorType) { + this.sensorType = sensorType; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/IotSitesListInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/IotSitesListInner.java new file mode 100644 index 000000000000..d2a293720595 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/IotSitesListInner.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of IoT sites. */ +@Immutable +public final class IotSitesListInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(IotSitesListInner.class); + + /* + * List data + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /** + * Get the value property: List data. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/IotSitesModelInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/IotSitesModelInner.java new file mode 100644 index 000000000000..d9b9d727f3d2 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/IotSitesModelInner.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** IoT site model. */ +@JsonFlatten +@Fluent +public class IotSitesModelInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(IotSitesModelInner.class); + + /* + * Display name of the IoT site + */ + @JsonProperty(value = "properties.displayName") + private String displayName; + + /* + * Tags of the IoT site + */ + @JsonProperty(value = "properties.tags") + private Map tags; + + /** + * Get the displayName property: Display name of the IoT site. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName property: Display name of the IoT site. + * + * @param displayName the displayName value to set. + * @return the IotSitesModelInner object itself. + */ + public IotSitesModelInner withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the tags property: Tags of the IoT site. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Tags of the IoT site. + * + * @param tags the tags value to set. + * @return the IotSitesModelInner object itself. + */ + public IotSitesModelInner withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/JitNetworkAccessPolicyInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/JitNetworkAccessPolicyInner.java new file mode 100644 index 000000000000..c75297e547f4 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/JitNetworkAccessPolicyInner.java @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.models.JitNetworkAccessPolicyVirtualMachine; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The JitNetworkAccessPolicy model. */ +@JsonFlatten +@Fluent +public class JitNetworkAccessPolicyInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(JitNetworkAccessPolicyInner.class); + + /* + * Configurations for Microsoft.Compute/virtualMachines resource type. + */ + @JsonProperty(value = "properties.virtualMachines", required = true) + private List virtualMachines; + + /* + * The requests property. + */ + @JsonProperty(value = "properties.requests") + private List requests; + + /* + * Gets the provisioning state of the Just-in-Time policy. + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /* + * Kind of the resource + */ + @JsonProperty(value = "kind") + private String kind; + + /* + * Location where the resource is stored + */ + @JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY) + private String location; + + /** + * Get the virtualMachines property: Configurations for Microsoft.Compute/virtualMachines resource type. + * + * @return the virtualMachines value. + */ + public List virtualMachines() { + return this.virtualMachines; + } + + /** + * Set the virtualMachines property: Configurations for Microsoft.Compute/virtualMachines resource type. + * + * @param virtualMachines the virtualMachines value to set. + * @return the JitNetworkAccessPolicyInner object itself. + */ + public JitNetworkAccessPolicyInner withVirtualMachines(List virtualMachines) { + this.virtualMachines = virtualMachines; + return this; + } + + /** + * Get the requests property: The requests property. + * + * @return the requests value. + */ + public List requests() { + return this.requests; + } + + /** + * Set the requests property: The requests property. + * + * @param requests the requests value to set. + * @return the JitNetworkAccessPolicyInner object itself. + */ + public JitNetworkAccessPolicyInner withRequests(List requests) { + this.requests = requests; + return this; + } + + /** + * Get the provisioningState property: Gets the provisioning state of the Just-in-Time policy. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Get the kind property: Kind of the resource. + * + * @return the kind value. + */ + public String kind() { + return this.kind; + } + + /** + * Set the kind property: Kind of the resource. + * + * @param kind the kind value to set. + * @return the JitNetworkAccessPolicyInner object itself. + */ + public JitNetworkAccessPolicyInner withKind(String kind) { + this.kind = kind; + return this; + } + + /** + * Get the location property: Location where the resource is stored. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (virtualMachines() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property virtualMachines in model JitNetworkAccessPolicyInner")); + } else { + virtualMachines().forEach(e -> e.validate()); + } + if (requests() != null) { + requests().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/JitNetworkAccessRequestInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/JitNetworkAccessRequestInner.java new file mode 100644 index 000000000000..d2d2fc28a8b6 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/JitNetworkAccessRequestInner.java @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.models.JitNetworkAccessRequestVirtualMachine; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** The JitNetworkAccessRequest model. */ +@Fluent +public final class JitNetworkAccessRequestInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(JitNetworkAccessRequestInner.class); + + /* + * The virtualMachines property. + */ + @JsonProperty(value = "virtualMachines", required = true) + private List virtualMachines; + + /* + * The start time of the request in UTC + */ + @JsonProperty(value = "startTimeUtc", required = true) + private OffsetDateTime startTimeUtc; + + /* + * The identity of the person who made the request + */ + @JsonProperty(value = "requestor", required = true) + private String requestor; + + /* + * The justification for making the initiate request + */ + @JsonProperty(value = "justification") + private String justification; + + /** + * Get the virtualMachines property: The virtualMachines property. + * + * @return the virtualMachines value. + */ + public List virtualMachines() { + return this.virtualMachines; + } + + /** + * Set the virtualMachines property: The virtualMachines property. + * + * @param virtualMachines the virtualMachines value to set. + * @return the JitNetworkAccessRequestInner object itself. + */ + public JitNetworkAccessRequestInner withVirtualMachines( + List virtualMachines) { + this.virtualMachines = virtualMachines; + return this; + } + + /** + * Get the startTimeUtc property: The start time of the request in UTC. + * + * @return the startTimeUtc value. + */ + public OffsetDateTime startTimeUtc() { + return this.startTimeUtc; + } + + /** + * Set the startTimeUtc property: The start time of the request in UTC. + * + * @param startTimeUtc the startTimeUtc value to set. + * @return the JitNetworkAccessRequestInner object itself. + */ + public JitNetworkAccessRequestInner withStartTimeUtc(OffsetDateTime startTimeUtc) { + this.startTimeUtc = startTimeUtc; + return this; + } + + /** + * Get the requestor property: The identity of the person who made the request. + * + * @return the requestor value. + */ + public String requestor() { + return this.requestor; + } + + /** + * Set the requestor property: The identity of the person who made the request. + * + * @param requestor the requestor value to set. + * @return the JitNetworkAccessRequestInner object itself. + */ + public JitNetworkAccessRequestInner withRequestor(String requestor) { + this.requestor = requestor; + return this; + } + + /** + * Get the justification property: The justification for making the initiate request. + * + * @return the justification value. + */ + public String justification() { + return this.justification; + } + + /** + * Set the justification property: The justification for making the initiate request. + * + * @param justification the justification value to set. + * @return the JitNetworkAccessRequestInner object itself. + */ + public JitNetworkAccessRequestInner withJustification(String justification) { + this.justification = justification; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (virtualMachines() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property virtualMachines in model JitNetworkAccessRequestInner")); + } else { + virtualMachines().forEach(e -> e.validate()); + } + if (startTimeUtc() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property startTimeUtc in model JitNetworkAccessRequestInner")); + } + if (requestor() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property requestor in model JitNetworkAccessRequestInner")); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/OnPremiseIotSensorInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/OnPremiseIotSensorInner.java new file mode 100644 index 000000000000..fd611d7dcc16 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/OnPremiseIotSensorInner.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** On-premise IoT sensor. */ +@Fluent +public final class OnPremiseIotSensorInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OnPremiseIotSensorInner.class); + + /* + * On-premise IoT sensor properties + */ + @JsonProperty(value = "properties") + private Object properties; + + /** + * Get the properties property: On-premise IoT sensor properties. + * + * @return the properties value. + */ + public Object properties() { + return this.properties; + } + + /** + * Set the properties property: On-premise IoT sensor properties. + * + * @param properties the properties value to set. + * @return the OnPremiseIotSensorInner object itself. + */ + public OnPremiseIotSensorInner withProperties(Object properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/OnPremiseIotSensorsListInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/OnPremiseIotSensorsListInner.java new file mode 100644 index 000000000000..a1b2eae47e53 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/OnPremiseIotSensorsListInner.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of on-premise IoT sensors. */ +@Immutable +public final class OnPremiseIotSensorsListInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OnPremiseIotSensorsListInner.class); + + /* + * List data + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /** + * Get the value property: List data. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/OperationInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/OperationInner.java new file mode 100644 index 000000000000..b327dc0ee685 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/OperationInner.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.models.OperationDisplay; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Possible operation in the REST API of Microsoft.Security. */ +@Fluent +public final class OperationInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationInner.class); + + /* + * Name of the operation + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * Where the operation is originated + */ + @JsonProperty(value = "origin", access = JsonProperty.Access.WRITE_ONLY) + private String origin; + + /* + * Security operation display + */ + @JsonProperty(value = "display") + private OperationDisplay display; + + /** + * Get the name property: Name of the operation. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the origin property: Where the operation is originated. + * + * @return the origin value. + */ + public String origin() { + return this.origin; + } + + /** + * Get the display property: Security operation display. + * + * @return the display value. + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Set the display property: Security operation display. + * + * @param display the display value to set. + * @return the OperationInner object itself. + */ + public OperationInner withDisplay(OperationDisplay display) { + this.display = display; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (display() != null) { + display().validate(); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/PackageDownloadsInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/PackageDownloadsInner.java new file mode 100644 index 000000000000..63aa43ea9fd5 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/PackageDownloadsInner.java @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.models.PackageDownloadInfo; +import com.azure.resourcemanager.security.models.PackageDownloadsCentralManager; +import com.azure.resourcemanager.security.models.PackageDownloadsSensor; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Information about package downloads. */ +@Immutable +public final class PackageDownloadsInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PackageDownloadsInner.class); + + /* + * Contains all Sensor binary downloads + */ + @JsonProperty(value = "sensor", access = JsonProperty.Access.WRITE_ONLY) + private PackageDownloadsSensor sensor; + + /* + * All downloads for Central Manager + */ + @JsonProperty(value = "centralManager", access = JsonProperty.Access.WRITE_ONLY) + private PackageDownloadsCentralManager centralManager; + + /* + * All downloads for threat intelligence + */ + @JsonProperty(value = "threatIntelligence", access = JsonProperty.Access.WRITE_ONLY) + private List threatIntelligence; + + /* + * SNMP Server file + */ + @JsonProperty(value = "snmp", access = JsonProperty.Access.WRITE_ONLY) + private List snmp; + + /* + * Used for local configuration export + */ + @JsonProperty(value = "wmiTool", access = JsonProperty.Access.WRITE_ONLY) + private List wmiTool; + + /* + * Authorized devices import template + */ + @JsonProperty(value = "authorizedDevicesImportTemplate", access = JsonProperty.Access.WRITE_ONLY) + private List authorizedDevicesImportTemplate; + + /* + * Authorized devices import template + */ + @JsonProperty(value = "deviceInformationUpdateImportTemplate", access = JsonProperty.Access.WRITE_ONLY) + private List deviceInformationUpdateImportTemplate; + + /** + * Get the sensor property: Contains all Sensor binary downloads. + * + * @return the sensor value. + */ + public PackageDownloadsSensor sensor() { + return this.sensor; + } + + /** + * Get the centralManager property: All downloads for Central Manager. + * + * @return the centralManager value. + */ + public PackageDownloadsCentralManager centralManager() { + return this.centralManager; + } + + /** + * Get the threatIntelligence property: All downloads for threat intelligence. + * + * @return the threatIntelligence value. + */ + public List threatIntelligence() { + return this.threatIntelligence; + } + + /** + * Get the snmp property: SNMP Server file. + * + * @return the snmp value. + */ + public List snmp() { + return this.snmp; + } + + /** + * Get the wmiTool property: Used for local configuration export. + * + * @return the wmiTool value. + */ + public List wmiTool() { + return this.wmiTool; + } + + /** + * Get the authorizedDevicesImportTemplate property: Authorized devices import template. + * + * @return the authorizedDevicesImportTemplate value. + */ + public List authorizedDevicesImportTemplate() { + return this.authorizedDevicesImportTemplate; + } + + /** + * Get the deviceInformationUpdateImportTemplate property: Authorized devices import template. + * + * @return the deviceInformationUpdateImportTemplate value. + */ + public List deviceInformationUpdateImportTemplate() { + return this.deviceInformationUpdateImportTemplate; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (sensor() != null) { + sensor().validate(); + } + if (centralManager() != null) { + centralManager().validate(); + } + if (threatIntelligence() != null) { + threatIntelligence().forEach(e -> e.validate()); + } + if (snmp() != null) { + snmp().forEach(e -> e.validate()); + } + if (wmiTool() != null) { + wmiTool().forEach(e -> e.validate()); + } + if (authorizedDevicesImportTemplate() != null) { + authorizedDevicesImportTemplate().forEach(e -> e.validate()); + } + if (deviceInformationUpdateImportTemplate() != null) { + deviceInformationUpdateImportTemplate().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/PricingInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/PricingInner.java new file mode 100644 index 000000000000..8549af68dab3 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/PricingInner.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.models.PricingTier; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.Duration; + +/** + * Azure Security Center is provided in two pricing tiers: free and standard, with the standard tier available with a + * trial period. The standard tier offers advanced security capabilities, while the free tier offers basic security + * features. + */ +@JsonFlatten +@Fluent +public class PricingInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PricingInner.class); + + /* + * The pricing tier value. Azure Security Center is provided in two pricing + * tiers: free and standard, with the standard tier available with a trial + * period. The standard tier offers advanced security capabilities, while + * the free tier offers basic security features. + */ + @JsonProperty(value = "properties.pricingTier") + private PricingTier pricingTier; + + /* + * The duration left for the subscriptions free trial period - in ISO 8601 + * format (e.g. P3Y6M4DT12H30M5S). + */ + @JsonProperty(value = "properties.freeTrialRemainingTime", access = JsonProperty.Access.WRITE_ONLY) + private Duration freeTrialRemainingTime; + + /** + * Get the pricingTier property: The pricing tier value. Azure Security Center is provided in two pricing tiers: + * free and standard, with the standard tier available with a trial period. The standard tier offers advanced + * security capabilities, while the free tier offers basic security features. + * + * @return the pricingTier value. + */ + public PricingTier pricingTier() { + return this.pricingTier; + } + + /** + * Set the pricingTier property: The pricing tier value. Azure Security Center is provided in two pricing tiers: + * free and standard, with the standard tier available with a trial period. The standard tier offers advanced + * security capabilities, while the free tier offers basic security features. + * + * @param pricingTier the pricingTier value to set. + * @return the PricingInner object itself. + */ + public PricingInner withPricingTier(PricingTier pricingTier) { + this.pricingTier = pricingTier; + return this; + } + + /** + * Get the freeTrialRemainingTime property: The duration left for the subscriptions free trial period - in ISO 8601 + * format (e.g. P3Y6M4DT12H30M5S). + * + * @return the freeTrialRemainingTime value. + */ + public Duration freeTrialRemainingTime() { + return this.freeTrialRemainingTime; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/PricingListInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/PricingListInner.java new file mode 100644 index 000000000000..b4f1491577a7 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/PricingListInner.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of pricing configurations response. */ +@Fluent +public final class PricingListInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PricingListInner.class); + + /* + * List of pricing configurations + */ + @JsonProperty(value = "value", required = true) + private List value; + + /** + * Get the value property: List of pricing configurations. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: List of pricing configurations. + * + * @param value the value value to set. + * @return the PricingListInner object itself. + */ + public PricingListInner withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property value in model PricingListInner")); + } else { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/RegulatoryComplianceAssessmentInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/RegulatoryComplianceAssessmentInner.java new file mode 100644 index 000000000000..b0907822e953 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/RegulatoryComplianceAssessmentInner.java @@ -0,0 +1,161 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.models.State; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Regulatory compliance assessment details and state. */ +@JsonFlatten +@Fluent +public class RegulatoryComplianceAssessmentInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RegulatoryComplianceAssessmentInner.class); + + /* + * The description of the regulatory compliance assessment + */ + @JsonProperty(value = "properties.description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /* + * The expected type of assessment contained in the AssessmentDetailsLink + */ + @JsonProperty(value = "properties.assessmentType", access = JsonProperty.Access.WRITE_ONLY) + private String assessmentType; + + /* + * Link to more detailed assessment results data. The response type will be + * according to the assessmentType field + */ + @JsonProperty(value = "properties.assessmentDetailsLink", access = JsonProperty.Access.WRITE_ONLY) + private String assessmentDetailsLink; + + /* + * Aggregative state based on the assessment's scanned resources states + */ + @JsonProperty(value = "properties.state") + private State state; + + /* + * The given assessment's related resources count with passed state. + */ + @JsonProperty(value = "properties.passedResources", access = JsonProperty.Access.WRITE_ONLY) + private Integer passedResources; + + /* + * The given assessment's related resources count with failed state. + */ + @JsonProperty(value = "properties.failedResources", access = JsonProperty.Access.WRITE_ONLY) + private Integer failedResources; + + /* + * The given assessment's related resources count with skipped state. + */ + @JsonProperty(value = "properties.skippedResources", access = JsonProperty.Access.WRITE_ONLY) + private Integer skippedResources; + + /* + * The given assessment's related resources count with unsupported state. + */ + @JsonProperty(value = "properties.unsupportedResources", access = JsonProperty.Access.WRITE_ONLY) + private Integer unsupportedResources; + + /** + * Get the description property: The description of the regulatory compliance assessment. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Get the assessmentType property: The expected type of assessment contained in the AssessmentDetailsLink. + * + * @return the assessmentType value. + */ + public String assessmentType() { + return this.assessmentType; + } + + /** + * Get the assessmentDetailsLink property: Link to more detailed assessment results data. The response type will be + * according to the assessmentType field. + * + * @return the assessmentDetailsLink value. + */ + public String assessmentDetailsLink() { + return this.assessmentDetailsLink; + } + + /** + * Get the state property: Aggregative state based on the assessment's scanned resources states. + * + * @return the state value. + */ + public State state() { + return this.state; + } + + /** + * Set the state property: Aggregative state based on the assessment's scanned resources states. + * + * @param state the state value to set. + * @return the RegulatoryComplianceAssessmentInner object itself. + */ + public RegulatoryComplianceAssessmentInner withState(State state) { + this.state = state; + return this; + } + + /** + * Get the passedResources property: The given assessment's related resources count with passed state. + * + * @return the passedResources value. + */ + public Integer passedResources() { + return this.passedResources; + } + + /** + * Get the failedResources property: The given assessment's related resources count with failed state. + * + * @return the failedResources value. + */ + public Integer failedResources() { + return this.failedResources; + } + + /** + * Get the skippedResources property: The given assessment's related resources count with skipped state. + * + * @return the skippedResources value. + */ + public Integer skippedResources() { + return this.skippedResources; + } + + /** + * Get the unsupportedResources property: The given assessment's related resources count with unsupported state. + * + * @return the unsupportedResources value. + */ + public Integer unsupportedResources() { + return this.unsupportedResources; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/RegulatoryComplianceControlInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/RegulatoryComplianceControlInner.java new file mode 100644 index 000000000000..2b4b62b95160 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/RegulatoryComplianceControlInner.java @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.models.State; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Regulatory compliance control details and state. */ +@JsonFlatten +@Fluent +public class RegulatoryComplianceControlInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RegulatoryComplianceControlInner.class); + + /* + * The description of the regulatory compliance control + */ + @JsonProperty(value = "properties.description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /* + * Aggregative state based on the control's supported assessments states + */ + @JsonProperty(value = "properties.state") + private State state; + + /* + * The number of supported regulatory compliance assessments of the given + * control with a passed state + */ + @JsonProperty(value = "properties.passedAssessments", access = JsonProperty.Access.WRITE_ONLY) + private Integer passedAssessments; + + /* + * The number of supported regulatory compliance assessments of the given + * control with a failed state + */ + @JsonProperty(value = "properties.failedAssessments", access = JsonProperty.Access.WRITE_ONLY) + private Integer failedAssessments; + + /* + * The number of supported regulatory compliance assessments of the given + * control with a skipped state + */ + @JsonProperty(value = "properties.skippedAssessments", access = JsonProperty.Access.WRITE_ONLY) + private Integer skippedAssessments; + + /** + * Get the description property: The description of the regulatory compliance control. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Get the state property: Aggregative state based on the control's supported assessments states. + * + * @return the state value. + */ + public State state() { + return this.state; + } + + /** + * Set the state property: Aggregative state based on the control's supported assessments states. + * + * @param state the state value to set. + * @return the RegulatoryComplianceControlInner object itself. + */ + public RegulatoryComplianceControlInner withState(State state) { + this.state = state; + return this; + } + + /** + * Get the passedAssessments property: The number of supported regulatory compliance assessments of the given + * control with a passed state. + * + * @return the passedAssessments value. + */ + public Integer passedAssessments() { + return this.passedAssessments; + } + + /** + * Get the failedAssessments property: The number of supported regulatory compliance assessments of the given + * control with a failed state. + * + * @return the failedAssessments value. + */ + public Integer failedAssessments() { + return this.failedAssessments; + } + + /** + * Get the skippedAssessments property: The number of supported regulatory compliance assessments of the given + * control with a skipped state. + * + * @return the skippedAssessments value. + */ + public Integer skippedAssessments() { + return this.skippedAssessments; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/RegulatoryComplianceStandardInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/RegulatoryComplianceStandardInner.java new file mode 100644 index 000000000000..4915169a0ebf --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/RegulatoryComplianceStandardInner.java @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.models.State; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Regulatory compliance standard details and state. */ +@JsonFlatten +@Fluent +public class RegulatoryComplianceStandardInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RegulatoryComplianceStandardInner.class); + + /* + * Aggregative state based on the standard's supported controls states + */ + @JsonProperty(value = "properties.state") + private State state; + + /* + * The number of supported regulatory compliance controls of the given + * standard with a passed state + */ + @JsonProperty(value = "properties.passedControls", access = JsonProperty.Access.WRITE_ONLY) + private Integer passedControls; + + /* + * The number of supported regulatory compliance controls of the given + * standard with a failed state + */ + @JsonProperty(value = "properties.failedControls", access = JsonProperty.Access.WRITE_ONLY) + private Integer failedControls; + + /* + * The number of supported regulatory compliance controls of the given + * standard with a skipped state + */ + @JsonProperty(value = "properties.skippedControls", access = JsonProperty.Access.WRITE_ONLY) + private Integer skippedControls; + + /* + * The number of regulatory compliance controls of the given standard which + * are unsupported by automated assessments + */ + @JsonProperty(value = "properties.unsupportedControls", access = JsonProperty.Access.WRITE_ONLY) + private Integer unsupportedControls; + + /** + * Get the state property: Aggregative state based on the standard's supported controls states. + * + * @return the state value. + */ + public State state() { + return this.state; + } + + /** + * Set the state property: Aggregative state based on the standard's supported controls states. + * + * @param state the state value to set. + * @return the RegulatoryComplianceStandardInner object itself. + */ + public RegulatoryComplianceStandardInner withState(State state) { + this.state = state; + return this; + } + + /** + * Get the passedControls property: The number of supported regulatory compliance controls of the given standard + * with a passed state. + * + * @return the passedControls value. + */ + public Integer passedControls() { + return this.passedControls; + } + + /** + * Get the failedControls property: The number of supported regulatory compliance controls of the given standard + * with a failed state. + * + * @return the failedControls value. + */ + public Integer failedControls() { + return this.failedControls; + } + + /** + * Get the skippedControls property: The number of supported regulatory compliance controls of the given standard + * with a skipped state. + * + * @return the skippedControls value. + */ + public Integer skippedControls() { + return this.skippedControls; + } + + /** + * Get the unsupportedControls property: The number of regulatory compliance controls of the given standard which + * are unsupported by automated assessments. + * + * @return the unsupportedControls value. + */ + public Integer unsupportedControls() { + return this.unsupportedControls; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/RuleResultsInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/RuleResultsInner.java new file mode 100644 index 000000000000..50e9ae7de000 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/RuleResultsInner.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.models.RuleResultsProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Rule results. */ +@Fluent +public final class RuleResultsInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RuleResultsInner.class); + + /* + * Rule results properties. + */ + @JsonProperty(value = "properties") + private RuleResultsProperties properties; + + /** + * Get the properties property: Rule results properties. + * + * @return the properties value. + */ + public RuleResultsProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Rule results properties. + * + * @param properties the properties value to set. + * @return the RuleResultsInner object itself. + */ + public RuleResultsInner withProperties(RuleResultsProperties properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/RulesResultsInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/RulesResultsInner.java new file mode 100644 index 000000000000..c711b06cc988 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/RulesResultsInner.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of rules results. */ +@Fluent +public final class RulesResultsInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RulesResultsInner.class); + + /* + * List of rule results. + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the value property: List of rule results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: List of rule results. + * + * @param value the value value to set. + * @return the RulesResultsInner object itself. + */ + public RulesResultsInner withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ScanInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ScanInner.java new file mode 100644 index 000000000000..30307a924d01 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ScanInner.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.models.ScanProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A vulnerability assessment scan record. */ +@Fluent +public final class ScanInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ScanInner.class); + + /* + * A vulnerability assessment scan record properties. + */ + @JsonProperty(value = "properties") + private ScanProperties properties; + + /** + * Get the properties property: A vulnerability assessment scan record properties. + * + * @return the properties value. + */ + public ScanProperties properties() { + return this.properties; + } + + /** + * Set the properties property: A vulnerability assessment scan record properties. + * + * @param properties the properties value to set. + * @return the ScanInner object itself. + */ + public ScanInner withProperties(ScanProperties properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ScanResultInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ScanResultInner.java new file mode 100644 index 000000000000..a749c3e1e5ff --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ScanResultInner.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.models.ScanResultProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A vulnerability assessment scan result for a single rule. */ +@Fluent +public final class ScanResultInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ScanResultInner.class); + + /* + * A vulnerability assessment scan result properties for a single rule. + */ + @JsonProperty(value = "properties") + private ScanResultProperties properties; + + /** + * Get the properties property: A vulnerability assessment scan result properties for a single rule. + * + * @return the properties value. + */ + public ScanResultProperties properties() { + return this.properties; + } + + /** + * Set the properties property: A vulnerability assessment scan result properties for a single rule. + * + * @param properties the properties value to set. + * @return the ScanResultInner object itself. + */ + public ScanResultInner withProperties(ScanResultProperties properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ScanResultsInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ScanResultsInner.java new file mode 100644 index 000000000000..0bc282c64d4e --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ScanResultsInner.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of vulnerability assessment scan results. */ +@Fluent +public final class ScanResultsInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ScanResultsInner.class); + + /* + * List of vulnerability assessment scan results. + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the value property: List of vulnerability assessment scan results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: List of vulnerability assessment scan results. + * + * @param value the value value to set. + * @return the ScanResultsInner object itself. + */ + public ScanResultsInner withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ScansInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ScansInner.java new file mode 100644 index 000000000000..cf178603ac0e --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ScansInner.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of vulnerability assessment scan records. */ +@Fluent +public final class ScansInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ScansInner.class); + + /* + * List of vulnerability assessment scan records. + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the value property: List of vulnerability assessment scan records. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: List of vulnerability assessment scan records. + * + * @param value the value value to set. + * @return the ScansInner object itself. + */ + public ScansInner withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecureScoreControlDefinitionItemInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecureScoreControlDefinitionItemInner.java new file mode 100644 index 000000000000..a4c873eeb2d0 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecureScoreControlDefinitionItemInner.java @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.models.AzureResourceLink; +import com.azure.resourcemanager.security.models.SecureScoreControlDefinitionSource; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Information about the security control. */ +@JsonFlatten +@Immutable +public class SecureScoreControlDefinitionItemInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SecureScoreControlDefinitionItemInner.class); + + /* + * User friendly display name of the control + */ + @JsonProperty(value = "properties.displayName", access = JsonProperty.Access.WRITE_ONLY) + private String displayName; + + /* + * User friendly description of the control + */ + @JsonProperty(value = "properties.description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /* + * Maximum control score (0..10) + */ + @JsonProperty(value = "properties.maxScore", access = JsonProperty.Access.WRITE_ONLY) + private Integer maxScore; + + /* + * Source object from which the control was created + */ + @JsonProperty(value = "properties.source", access = JsonProperty.Access.WRITE_ONLY) + private SecureScoreControlDefinitionSource source; + + /* + * Array of assessments metadata IDs that are included in this security + * control + */ + @JsonProperty(value = "properties.assessmentDefinitions", access = JsonProperty.Access.WRITE_ONLY) + private List assessmentDefinitions; + + /** + * Get the displayName property: User friendly display name of the control. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Get the description property: User friendly description of the control. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Get the maxScore property: Maximum control score (0..10). + * + * @return the maxScore value. + */ + public Integer maxScore() { + return this.maxScore; + } + + /** + * Get the source property: Source object from which the control was created. + * + * @return the source value. + */ + public SecureScoreControlDefinitionSource source() { + return this.source; + } + + /** + * Get the assessmentDefinitions property: Array of assessments metadata IDs that are included in this security + * control. + * + * @return the assessmentDefinitions value. + */ + public List assessmentDefinitions() { + return this.assessmentDefinitions; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (source() != null) { + source().validate(); + } + if (assessmentDefinitions() != null) { + assessmentDefinitions().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecureScoreControlDetailsInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecureScoreControlDetailsInner.java new file mode 100644 index 000000000000..d824307e2581 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecureScoreControlDetailsInner.java @@ -0,0 +1,181 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Details of the security control, its score, and the health status of the relevant resources. */ +@JsonFlatten +@Fluent +public class SecureScoreControlDetailsInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SecureScoreControlDetailsInner.class); + + /* + * User friendly display name of the control + */ + @JsonProperty(value = "properties.displayName", access = JsonProperty.Access.WRITE_ONLY) + private String displayName; + + /* + * Number of healthy resources in the control + */ + @JsonProperty(value = "properties.healthyResourceCount", access = JsonProperty.Access.WRITE_ONLY) + private Integer healthyResourceCount; + + /* + * Number of unhealthy resources in the control + */ + @JsonProperty(value = "properties.unhealthyResourceCount", access = JsonProperty.Access.WRITE_ONLY) + private Integer unhealthyResourceCount; + + /* + * Number of not applicable resources in the control + */ + @JsonProperty(value = "properties.notApplicableResourceCount", access = JsonProperty.Access.WRITE_ONLY) + private Integer notApplicableResourceCount; + + /* + * The relative weight for this specific control in each of your + * subscriptions. Used when calculating an aggregated score for this + * control across all of your subscriptions. + */ + @JsonProperty(value = "properties.weight", access = JsonProperty.Access.WRITE_ONLY) + private Long weight; + + /* + * Information about the security control. + */ + @JsonProperty(value = "properties.definition") + private SecureScoreControlDefinitionItemInner definition; + + /* + * Maximum score available + */ + @JsonProperty(value = "properties.score.max", access = JsonProperty.Access.WRITE_ONLY) + private Integer max; + + /* + * Current score + */ + @JsonProperty(value = "properties.score.current", access = JsonProperty.Access.WRITE_ONLY) + private Double current; + + /* + * Ratio of the current score divided by the maximum. Rounded to 4 digits + * after the decimal point + */ + @JsonProperty(value = "properties.score.percentage", access = JsonProperty.Access.WRITE_ONLY) + private Double percentage; + + /** + * Get the displayName property: User friendly display name of the control. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Get the healthyResourceCount property: Number of healthy resources in the control. + * + * @return the healthyResourceCount value. + */ + public Integer healthyResourceCount() { + return this.healthyResourceCount; + } + + /** + * Get the unhealthyResourceCount property: Number of unhealthy resources in the control. + * + * @return the unhealthyResourceCount value. + */ + public Integer unhealthyResourceCount() { + return this.unhealthyResourceCount; + } + + /** + * Get the notApplicableResourceCount property: Number of not applicable resources in the control. + * + * @return the notApplicableResourceCount value. + */ + public Integer notApplicableResourceCount() { + return this.notApplicableResourceCount; + } + + /** + * Get the weight property: The relative weight for this specific control in each of your subscriptions. Used when + * calculating an aggregated score for this control across all of your subscriptions. + * + * @return the weight value. + */ + public Long weight() { + return this.weight; + } + + /** + * Get the definition property: Information about the security control. + * + * @return the definition value. + */ + public SecureScoreControlDefinitionItemInner definition() { + return this.definition; + } + + /** + * Set the definition property: Information about the security control. + * + * @param definition the definition value to set. + * @return the SecureScoreControlDetailsInner object itself. + */ + public SecureScoreControlDetailsInner withDefinition(SecureScoreControlDefinitionItemInner definition) { + this.definition = definition; + return this; + } + + /** + * Get the max property: Maximum score available. + * + * @return the max value. + */ + public Integer max() { + return this.max; + } + + /** + * Get the current property: Current score. + * + * @return the current value. + */ + public Double current() { + return this.current; + } + + /** + * Get the percentage property: Ratio of the current score divided by the maximum. Rounded to 4 digits after the + * decimal point. + * + * @return the percentage value. + */ + public Double percentage() { + return this.percentage; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (definition() != null) { + definition().validate(); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecureScoreItemInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecureScoreItemInner.java new file mode 100644 index 000000000000..281540025b53 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecureScoreItemInner.java @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Secure score item data model. */ +@JsonFlatten +@Immutable +public class SecureScoreItemInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SecureScoreItemInner.class); + + /* + * The initiative’s name + */ + @JsonProperty(value = "properties.displayName", access = JsonProperty.Access.WRITE_ONLY) + private String displayName; + + /* + * The relative weight for each subscription. Used when calculating an + * aggregated secure score for multiple subscriptions. + */ + @JsonProperty(value = "properties.weight", access = JsonProperty.Access.WRITE_ONLY) + private Long weight; + + /* + * Maximum score available + */ + @JsonProperty(value = "properties.score.max", access = JsonProperty.Access.WRITE_ONLY) + private Integer max; + + /* + * Current score + */ + @JsonProperty(value = "properties.score.current", access = JsonProperty.Access.WRITE_ONLY) + private Double current; + + /* + * Ratio of the current score divided by the maximum. Rounded to 4 digits + * after the decimal point + */ + @JsonProperty(value = "properties.score.percentage", access = JsonProperty.Access.WRITE_ONLY) + private Double percentage; + + /** + * Get the displayName property: The initiative’s name. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Get the weight property: The relative weight for each subscription. Used when calculating an aggregated secure + * score for multiple subscriptions. + * + * @return the weight value. + */ + public Long weight() { + return this.weight; + } + + /** + * Get the max property: Maximum score available. + * + * @return the max value. + */ + public Integer max() { + return this.max; + } + + /** + * Get the current property: Current score. + * + * @return the current value. + */ + public Double current() { + return this.current; + } + + /** + * Get the percentage property: Ratio of the current score divided by the maximum. Rounded to 4 digits after the + * decimal point. + * + * @return the percentage value. + */ + public Double percentage() { + return this.percentage; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecurityAssessmentInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecurityAssessmentInner.java new file mode 100644 index 000000000000..c053d6cb76b9 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecurityAssessmentInner.java @@ -0,0 +1,208 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.models.AssessmentLinks; +import com.azure.resourcemanager.security.models.AssessmentStatus; +import com.azure.resourcemanager.security.models.ResourceDetails; +import com.azure.resourcemanager.security.models.SecurityAssessmentMetadataProperties; +import com.azure.resourcemanager.security.models.SecurityAssessmentPartnerData; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Security assessment on a resource. */ +@JsonFlatten +@Fluent +public class SecurityAssessmentInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SecurityAssessmentInner.class); + + /* + * Details of the resource that was assessed + */ + @JsonProperty(value = "properties.resourceDetails") + private ResourceDetails resourceDetails; + + /* + * User friendly display name of the assessment + */ + @JsonProperty(value = "properties.displayName", access = JsonProperty.Access.WRITE_ONLY) + private String displayName; + + /* + * The result of the assessment + */ + @JsonProperty(value = "properties.status") + private AssessmentStatus status; + + /* + * Additional data regarding the assessment + */ + @JsonProperty(value = "properties.additionalData") + private Map additionalData; + + /* + * Links relevant to the assessment + */ + @JsonProperty(value = "properties.links", access = JsonProperty.Access.WRITE_ONLY) + private AssessmentLinks links; + + /* + * Describes properties of an assessment metadata. + */ + @JsonProperty(value = "properties.metadata") + private SecurityAssessmentMetadataProperties metadata; + + /* + * Data regarding 3rd party partner integration + */ + @JsonProperty(value = "properties.partnersData") + private SecurityAssessmentPartnerData partnersData; + + /** + * Get the resourceDetails property: Details of the resource that was assessed. + * + * @return the resourceDetails value. + */ + public ResourceDetails resourceDetails() { + return this.resourceDetails; + } + + /** + * Set the resourceDetails property: Details of the resource that was assessed. + * + * @param resourceDetails the resourceDetails value to set. + * @return the SecurityAssessmentInner object itself. + */ + public SecurityAssessmentInner withResourceDetails(ResourceDetails resourceDetails) { + this.resourceDetails = resourceDetails; + return this; + } + + /** + * Get the displayName property: User friendly display name of the assessment. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Get the status property: The result of the assessment. + * + * @return the status value. + */ + public AssessmentStatus status() { + return this.status; + } + + /** + * Set the status property: The result of the assessment. + * + * @param status the status value to set. + * @return the SecurityAssessmentInner object itself. + */ + public SecurityAssessmentInner withStatus(AssessmentStatus status) { + this.status = status; + return this; + } + + /** + * Get the additionalData property: Additional data regarding the assessment. + * + * @return the additionalData value. + */ + public Map additionalData() { + return this.additionalData; + } + + /** + * Set the additionalData property: Additional data regarding the assessment. + * + * @param additionalData the additionalData value to set. + * @return the SecurityAssessmentInner object itself. + */ + public SecurityAssessmentInner withAdditionalData(Map additionalData) { + this.additionalData = additionalData; + return this; + } + + /** + * Get the links property: Links relevant to the assessment. + * + * @return the links value. + */ + public AssessmentLinks links() { + return this.links; + } + + /** + * Get the metadata property: Describes properties of an assessment metadata. + * + * @return the metadata value. + */ + public SecurityAssessmentMetadataProperties metadata() { + return this.metadata; + } + + /** + * Set the metadata property: Describes properties of an assessment metadata. + * + * @param metadata the metadata value to set. + * @return the SecurityAssessmentInner object itself. + */ + public SecurityAssessmentInner withMetadata(SecurityAssessmentMetadataProperties metadata) { + this.metadata = metadata; + return this; + } + + /** + * Get the partnersData property: Data regarding 3rd party partner integration. + * + * @return the partnersData value. + */ + public SecurityAssessmentPartnerData partnersData() { + return this.partnersData; + } + + /** + * Set the partnersData property: Data regarding 3rd party partner integration. + * + * @param partnersData the partnersData value to set. + * @return the SecurityAssessmentInner object itself. + */ + public SecurityAssessmentInner withPartnersData(SecurityAssessmentPartnerData partnersData) { + this.partnersData = partnersData; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (resourceDetails() != null) { + resourceDetails().validate(); + } + if (status() != null) { + status().validate(); + } + if (links() != null) { + links().validate(); + } + if (metadata() != null) { + metadata().validate(); + } + if (partnersData() != null) { + partnersData().validate(); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecurityAssessmentMetadataInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecurityAssessmentMetadataInner.java new file mode 100644 index 000000000000..0df3e3eb6906 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecurityAssessmentMetadataInner.java @@ -0,0 +1,347 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.models.AssessmentType; +import com.azure.resourcemanager.security.models.Categories; +import com.azure.resourcemanager.security.models.ImplementationEffort; +import com.azure.resourcemanager.security.models.SecurityAssessmentMetadataPartnerData; +import com.azure.resourcemanager.security.models.Severity; +import com.azure.resourcemanager.security.models.Threats; +import com.azure.resourcemanager.security.models.UserImpact; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Security assessment metadata. */ +@JsonFlatten +@Fluent +public class SecurityAssessmentMetadataInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SecurityAssessmentMetadataInner.class); + + /* + * User friendly display name of the assessment + */ + @JsonProperty(value = "properties.displayName") + private String displayName; + + /* + * Azure resource ID of the policy definition that turns this assessment + * calculation on + */ + @JsonProperty(value = "properties.policyDefinitionId", access = JsonProperty.Access.WRITE_ONLY) + private String policyDefinitionId; + + /* + * Human readable description of the assessment + */ + @JsonProperty(value = "properties.description") + private String description; + + /* + * Human readable description of what you should do to mitigate this + * security issue + */ + @JsonProperty(value = "properties.remediationDescription") + private String remediationDescription; + + /* + * The categories property. + */ + @JsonProperty(value = "properties.categories") + private List categories; + + /* + * The severity level of the assessment + */ + @JsonProperty(value = "properties.severity") + private Severity severity; + + /* + * The user impact of the assessment + */ + @JsonProperty(value = "properties.userImpact") + private UserImpact userImpact; + + /* + * The implementation effort required to remediate this assessment + */ + @JsonProperty(value = "properties.implementationEffort") + private ImplementationEffort implementationEffort; + + /* + * The threats property. + */ + @JsonProperty(value = "properties.threats") + private List threats; + + /* + * True if this assessment is in preview release status + */ + @JsonProperty(value = "properties.preview") + private Boolean preview; + + /* + * BuiltIn if the assessment based on built-in Azure Policy definition, + * Custom if the assessment based on custom Azure Policy definition + */ + @JsonProperty(value = "properties.assessmentType") + private AssessmentType assessmentType; + + /* + * Describes the partner that created the assessment + */ + @JsonProperty(value = "properties.partnerData") + private SecurityAssessmentMetadataPartnerData partnerData; + + /** + * Get the displayName property: User friendly display name of the assessment. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName property: User friendly display name of the assessment. + * + * @param displayName the displayName value to set. + * @return the SecurityAssessmentMetadataInner object itself. + */ + public SecurityAssessmentMetadataInner withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the policyDefinitionId property: Azure resource ID of the policy definition that turns this assessment + * calculation on. + * + * @return the policyDefinitionId value. + */ + public String policyDefinitionId() { + return this.policyDefinitionId; + } + + /** + * Get the description property: Human readable description of the assessment. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: Human readable description of the assessment. + * + * @param description the description value to set. + * @return the SecurityAssessmentMetadataInner object itself. + */ + public SecurityAssessmentMetadataInner withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the remediationDescription property: Human readable description of what you should do to mitigate this + * security issue. + * + * @return the remediationDescription value. + */ + public String remediationDescription() { + return this.remediationDescription; + } + + /** + * Set the remediationDescription property: Human readable description of what you should do to mitigate this + * security issue. + * + * @param remediationDescription the remediationDescription value to set. + * @return the SecurityAssessmentMetadataInner object itself. + */ + public SecurityAssessmentMetadataInner withRemediationDescription(String remediationDescription) { + this.remediationDescription = remediationDescription; + return this; + } + + /** + * Get the categories property: The categories property. + * + * @return the categories value. + */ + public List categories() { + return this.categories; + } + + /** + * Set the categories property: The categories property. + * + * @param categories the categories value to set. + * @return the SecurityAssessmentMetadataInner object itself. + */ + public SecurityAssessmentMetadataInner withCategories(List categories) { + this.categories = categories; + return this; + } + + /** + * Get the severity property: The severity level of the assessment. + * + * @return the severity value. + */ + public Severity severity() { + return this.severity; + } + + /** + * Set the severity property: The severity level of the assessment. + * + * @param severity the severity value to set. + * @return the SecurityAssessmentMetadataInner object itself. + */ + public SecurityAssessmentMetadataInner withSeverity(Severity severity) { + this.severity = severity; + return this; + } + + /** + * Get the userImpact property: The user impact of the assessment. + * + * @return the userImpact value. + */ + public UserImpact userImpact() { + return this.userImpact; + } + + /** + * Set the userImpact property: The user impact of the assessment. + * + * @param userImpact the userImpact value to set. + * @return the SecurityAssessmentMetadataInner object itself. + */ + public SecurityAssessmentMetadataInner withUserImpact(UserImpact userImpact) { + this.userImpact = userImpact; + return this; + } + + /** + * Get the implementationEffort property: The implementation effort required to remediate this assessment. + * + * @return the implementationEffort value. + */ + public ImplementationEffort implementationEffort() { + return this.implementationEffort; + } + + /** + * Set the implementationEffort property: The implementation effort required to remediate this assessment. + * + * @param implementationEffort the implementationEffort value to set. + * @return the SecurityAssessmentMetadataInner object itself. + */ + public SecurityAssessmentMetadataInner withImplementationEffort(ImplementationEffort implementationEffort) { + this.implementationEffort = implementationEffort; + return this; + } + + /** + * Get the threats property: The threats property. + * + * @return the threats value. + */ + public List threats() { + return this.threats; + } + + /** + * Set the threats property: The threats property. + * + * @param threats the threats value to set. + * @return the SecurityAssessmentMetadataInner object itself. + */ + public SecurityAssessmentMetadataInner withThreats(List threats) { + this.threats = threats; + return this; + } + + /** + * Get the preview property: True if this assessment is in preview release status. + * + * @return the preview value. + */ + public Boolean preview() { + return this.preview; + } + + /** + * Set the preview property: True if this assessment is in preview release status. + * + * @param preview the preview value to set. + * @return the SecurityAssessmentMetadataInner object itself. + */ + public SecurityAssessmentMetadataInner withPreview(Boolean preview) { + this.preview = preview; + return this; + } + + /** + * Get the assessmentType property: BuiltIn if the assessment based on built-in Azure Policy definition, Custom if + * the assessment based on custom Azure Policy definition. + * + * @return the assessmentType value. + */ + public AssessmentType assessmentType() { + return this.assessmentType; + } + + /** + * Set the assessmentType property: BuiltIn if the assessment based on built-in Azure Policy definition, Custom if + * the assessment based on custom Azure Policy definition. + * + * @param assessmentType the assessmentType value to set. + * @return the SecurityAssessmentMetadataInner object itself. + */ + public SecurityAssessmentMetadataInner withAssessmentType(AssessmentType assessmentType) { + this.assessmentType = assessmentType; + return this; + } + + /** + * Get the partnerData property: Describes the partner that created the assessment. + * + * @return the partnerData value. + */ + public SecurityAssessmentMetadataPartnerData partnerData() { + return this.partnerData; + } + + /** + * Set the partnerData property: Describes the partner that created the assessment. + * + * @param partnerData the partnerData value to set. + * @return the SecurityAssessmentMetadataInner object itself. + */ + public SecurityAssessmentMetadataInner withPartnerData(SecurityAssessmentMetadataPartnerData partnerData) { + this.partnerData = partnerData; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (partnerData() != null) { + partnerData().validate(); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecurityContactInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecurityContactInner.java new file mode 100644 index 000000000000..656f9d83c816 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecurityContactInner.java @@ -0,0 +1,133 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.models.AlertNotifications; +import com.azure.resourcemanager.security.models.AlertsToAdmins; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Contact details for security issues. */ +@JsonFlatten +@Fluent +public class SecurityContactInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SecurityContactInner.class); + + /* + * The email of this security contact + */ + @JsonProperty(value = "properties.email") + private String email; + + /* + * The phone number of this security contact + */ + @JsonProperty(value = "properties.phone") + private String phone; + + /* + * Whether to send security alerts notifications to the security contact + */ + @JsonProperty(value = "properties.alertNotifications") + private AlertNotifications alertNotifications; + + /* + * Whether to send security alerts notifications to subscription admins + */ + @JsonProperty(value = "properties.alertsToAdmins") + private AlertsToAdmins alertsToAdmins; + + /** + * Get the email property: The email of this security contact. + * + * @return the email value. + */ + public String email() { + return this.email; + } + + /** + * Set the email property: The email of this security contact. + * + * @param email the email value to set. + * @return the SecurityContactInner object itself. + */ + public SecurityContactInner withEmail(String email) { + this.email = email; + return this; + } + + /** + * Get the phone property: The phone number of this security contact. + * + * @return the phone value. + */ + public String phone() { + return this.phone; + } + + /** + * Set the phone property: The phone number of this security contact. + * + * @param phone the phone value to set. + * @return the SecurityContactInner object itself. + */ + public SecurityContactInner withPhone(String phone) { + this.phone = phone; + return this; + } + + /** + * Get the alertNotifications property: Whether to send security alerts notifications to the security contact. + * + * @return the alertNotifications value. + */ + public AlertNotifications alertNotifications() { + return this.alertNotifications; + } + + /** + * Set the alertNotifications property: Whether to send security alerts notifications to the security contact. + * + * @param alertNotifications the alertNotifications value to set. + * @return the SecurityContactInner object itself. + */ + public SecurityContactInner withAlertNotifications(AlertNotifications alertNotifications) { + this.alertNotifications = alertNotifications; + return this; + } + + /** + * Get the alertsToAdmins property: Whether to send security alerts notifications to subscription admins. + * + * @return the alertsToAdmins value. + */ + public AlertsToAdmins alertsToAdmins() { + return this.alertsToAdmins; + } + + /** + * Set the alertsToAdmins property: Whether to send security alerts notifications to subscription admins. + * + * @param alertsToAdmins the alertsToAdmins value to set. + * @return the SecurityContactInner object itself. + */ + public SecurityContactInner withAlertsToAdmins(AlertsToAdmins alertsToAdmins) { + this.alertsToAdmins = alertsToAdmins; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecuritySolutionInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecuritySolutionInner.java new file mode 100644 index 000000000000..36e04e104423 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecuritySolutionInner.java @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.models.ProvisioningState; +import com.azure.resourcemanager.security.models.SecurityFamily; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The SecuritySolution model. */ +@JsonFlatten +@Fluent +public class SecuritySolutionInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SecuritySolutionInner.class); + + /* + * The security family of the security solution + */ + @JsonProperty(value = "properties.securityFamily") + private SecurityFamily securityFamily; + + /* + * The security family provisioning State + */ + @JsonProperty(value = "properties.provisioningState") + private ProvisioningState provisioningState; + + /* + * The security solutions' template + */ + @JsonProperty(value = "properties.template") + private String template; + + /* + * The security solutions' status + */ + @JsonProperty(value = "properties.protectionStatus") + private String protectionStatus; + + /* + * Location where the resource is stored + */ + @JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY) + private String location; + + /** + * Get the securityFamily property: The security family of the security solution. + * + * @return the securityFamily value. + */ + public SecurityFamily securityFamily() { + return this.securityFamily; + } + + /** + * Set the securityFamily property: The security family of the security solution. + * + * @param securityFamily the securityFamily value to set. + * @return the SecuritySolutionInner object itself. + */ + public SecuritySolutionInner withSecurityFamily(SecurityFamily securityFamily) { + this.securityFamily = securityFamily; + return this; + } + + /** + * Get the provisioningState property: The security family provisioning State. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Set the provisioningState property: The security family provisioning State. + * + * @param provisioningState the provisioningState value to set. + * @return the SecuritySolutionInner object itself. + */ + public SecuritySolutionInner withProvisioningState(ProvisioningState provisioningState) { + this.provisioningState = provisioningState; + return this; + } + + /** + * Get the template property: The security solutions' template. + * + * @return the template value. + */ + public String template() { + return this.template; + } + + /** + * Set the template property: The security solutions' template. + * + * @param template the template value to set. + * @return the SecuritySolutionInner object itself. + */ + public SecuritySolutionInner withTemplate(String template) { + this.template = template; + return this; + } + + /** + * Get the protectionStatus property: The security solutions' status. + * + * @return the protectionStatus value. + */ + public String protectionStatus() { + return this.protectionStatus; + } + + /** + * Set the protectionStatus property: The security solutions' status. + * + * @param protectionStatus the protectionStatus value to set. + * @return the SecuritySolutionInner object itself. + */ + public SecuritySolutionInner withProtectionStatus(String protectionStatus) { + this.protectionStatus = protectionStatus; + return this; + } + + /** + * Get the location property: Location where the resource is stored. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecuritySolutionsReferenceDataListInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecuritySolutionsReferenceDataListInner.java new file mode 100644 index 000000000000..e0f70d353ef1 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecuritySolutionsReferenceDataListInner.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.models.SecuritySolutionsReferenceData; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The SecuritySolutionsReferenceDataList model. */ +@Fluent +public final class SecuritySolutionsReferenceDataListInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SecuritySolutionsReferenceDataListInner.class); + + /* + * The value property. + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the value property: The value property. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The value property. + * + * @param value the value value to set. + * @return the SecuritySolutionsReferenceDataListInner object itself. + */ + public SecuritySolutionsReferenceDataListInner withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecuritySubAssessmentInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecuritySubAssessmentInner.java new file mode 100644 index 000000000000..42a0848af5b5 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecuritySubAssessmentInner.java @@ -0,0 +1,223 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.models.AdditionalData; +import com.azure.resourcemanager.security.models.ResourceDetails; +import com.azure.resourcemanager.security.models.SubAssessmentStatus; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Security sub-assessment on a resource. */ +@JsonFlatten +@Fluent +public class SecuritySubAssessmentInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SecuritySubAssessmentInner.class); + + /* + * Vulnerability ID + */ + @JsonProperty(value = "properties.id", access = JsonProperty.Access.WRITE_ONLY) + private String idPropertiesId; + + /* + * User friendly display name of the sub-assessment + */ + @JsonProperty(value = "properties.displayName", access = JsonProperty.Access.WRITE_ONLY) + private String displayName; + + /* + * Status of the sub-assessment + */ + @JsonProperty(value = "properties.status") + private SubAssessmentStatus status; + + /* + * Information on how to remediate this sub-assessment + */ + @JsonProperty(value = "properties.remediation", access = JsonProperty.Access.WRITE_ONLY) + private String remediation; + + /* + * Description of the impact of this sub-assessment + */ + @JsonProperty(value = "properties.impact", access = JsonProperty.Access.WRITE_ONLY) + private String impact; + + /* + * Category of the sub-assessment + */ + @JsonProperty(value = "properties.category", access = JsonProperty.Access.WRITE_ONLY) + private String category; + + /* + * Human readable description of the assessment status + */ + @JsonProperty(value = "properties.description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /* + * The date and time the sub-assessment was generated + */ + @JsonProperty(value = "properties.timeGenerated", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime timeGenerated; + + /* + * Details of the resource that was assessed + */ + @JsonProperty(value = "properties.resourceDetails") + private ResourceDetails resourceDetails; + + /* + * Details of the sub-assessment + */ + @JsonProperty(value = "properties.additionalData") + private AdditionalData additionalData; + + /** + * Get the idPropertiesId property: Vulnerability ID. + * + * @return the idPropertiesId value. + */ + public String idPropertiesId() { + return this.idPropertiesId; + } + + /** + * Get the displayName property: User friendly display name of the sub-assessment. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Get the status property: Status of the sub-assessment. + * + * @return the status value. + */ + public SubAssessmentStatus status() { + return this.status; + } + + /** + * Set the status property: Status of the sub-assessment. + * + * @param status the status value to set. + * @return the SecuritySubAssessmentInner object itself. + */ + public SecuritySubAssessmentInner withStatus(SubAssessmentStatus status) { + this.status = status; + return this; + } + + /** + * Get the remediation property: Information on how to remediate this sub-assessment. + * + * @return the remediation value. + */ + public String remediation() { + return this.remediation; + } + + /** + * Get the impact property: Description of the impact of this sub-assessment. + * + * @return the impact value. + */ + public String impact() { + return this.impact; + } + + /** + * Get the category property: Category of the sub-assessment. + * + * @return the category value. + */ + public String category() { + return this.category; + } + + /** + * Get the description property: Human readable description of the assessment status. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Get the timeGenerated property: The date and time the sub-assessment was generated. + * + * @return the timeGenerated value. + */ + public OffsetDateTime timeGenerated() { + return this.timeGenerated; + } + + /** + * Get the resourceDetails property: Details of the resource that was assessed. + * + * @return the resourceDetails value. + */ + public ResourceDetails resourceDetails() { + return this.resourceDetails; + } + + /** + * Set the resourceDetails property: Details of the resource that was assessed. + * + * @param resourceDetails the resourceDetails value to set. + * @return the SecuritySubAssessmentInner object itself. + */ + public SecuritySubAssessmentInner withResourceDetails(ResourceDetails resourceDetails) { + this.resourceDetails = resourceDetails; + return this; + } + + /** + * Get the additionalData property: Details of the sub-assessment. + * + * @return the additionalData value. + */ + public AdditionalData additionalData() { + return this.additionalData; + } + + /** + * Set the additionalData property: Details of the sub-assessment. + * + * @param additionalData the additionalData value to set. + * @return the SecuritySubAssessmentInner object itself. + */ + public SecuritySubAssessmentInner withAdditionalData(AdditionalData additionalData) { + this.additionalData = additionalData; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (status() != null) { + status().validate(); + } + if (resourceDetails() != null) { + resourceDetails().validate(); + } + if (additionalData() != null) { + additionalData().validate(); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecurityTaskInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecurityTaskInner.java new file mode 100644 index 000000000000..f57df511cb02 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecurityTaskInner.java @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.models.SecurityTaskParameters; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Security task that we recommend to do in order to strengthen security. */ +@JsonFlatten +@Fluent +public class SecurityTaskInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SecurityTaskInner.class); + + /* + * State of the task (Active, Resolved etc.) + */ + @JsonProperty(value = "properties.state", access = JsonProperty.Access.WRITE_ONLY) + private String state; + + /* + * The time this task was discovered in UTC + */ + @JsonProperty(value = "properties.creationTimeUtc", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime creationTimeUtc; + + /* + * Changing set of properties, depending on the task type that is derived + * from the name field + */ + @JsonProperty(value = "properties.securityTaskParameters") + private SecurityTaskParameters securityTaskParameters; + + /* + * The time this task's details were last changed in UTC + */ + @JsonProperty(value = "properties.lastStateChangeTimeUtc", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime lastStateChangeTimeUtc; + + /* + * Additional data on the state of the task + */ + @JsonProperty(value = "properties.subState", access = JsonProperty.Access.WRITE_ONLY) + private String subState; + + /** + * Get the state property: State of the task (Active, Resolved etc.). + * + * @return the state value. + */ + public String state() { + return this.state; + } + + /** + * Get the creationTimeUtc property: The time this task was discovered in UTC. + * + * @return the creationTimeUtc value. + */ + public OffsetDateTime creationTimeUtc() { + return this.creationTimeUtc; + } + + /** + * Get the securityTaskParameters property: Changing set of properties, depending on the task type that is derived + * from the name field. + * + * @return the securityTaskParameters value. + */ + public SecurityTaskParameters securityTaskParameters() { + return this.securityTaskParameters; + } + + /** + * Set the securityTaskParameters property: Changing set of properties, depending on the task type that is derived + * from the name field. + * + * @param securityTaskParameters the securityTaskParameters value to set. + * @return the SecurityTaskInner object itself. + */ + public SecurityTaskInner withSecurityTaskParameters(SecurityTaskParameters securityTaskParameters) { + this.securityTaskParameters = securityTaskParameters; + return this; + } + + /** + * Get the lastStateChangeTimeUtc property: The time this task's details were last changed in UTC. + * + * @return the lastStateChangeTimeUtc value. + */ + public OffsetDateTime lastStateChangeTimeUtc() { + return this.lastStateChangeTimeUtc; + } + + /** + * Get the subState property: Additional data on the state of the task. + * + * @return the subState value. + */ + public String subState() { + return this.subState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (securityTaskParameters() != null) { + securityTaskParameters().validate(); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ServerVulnerabilityAssessmentInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ServerVulnerabilityAssessmentInner.java new file mode 100644 index 000000000000..dfd4dfbd378a --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ServerVulnerabilityAssessmentInner.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.models.ServerVulnerabilityAssessmentPropertiesProvisioningState; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Describes the server vulnerability assessment details on a resource. */ +@JsonFlatten +@Immutable +public class ServerVulnerabilityAssessmentInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServerVulnerabilityAssessmentInner.class); + + /* + * The provisioningState of the vulnerability assessment capability on the + * VM + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ServerVulnerabilityAssessmentPropertiesProvisioningState provisioningState; + + /** + * Get the provisioningState property: The provisioningState of the vulnerability assessment capability on the VM. + * + * @return the provisioningState value. + */ + public ServerVulnerabilityAssessmentPropertiesProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ServerVulnerabilityAssessmentsListInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ServerVulnerabilityAssessmentsListInner.java new file mode 100644 index 000000000000..0cc3d869621a --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ServerVulnerabilityAssessmentsListInner.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of server vulnerability assessments. */ +@Fluent +public final class ServerVulnerabilityAssessmentsListInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServerVulnerabilityAssessmentsListInner.class); + + /* + * The value property. + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the value property: The value property. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The value property. + * + * @param value the value value to set. + * @return the ServerVulnerabilityAssessmentsListInner object itself. + */ + public ServerVulnerabilityAssessmentsListInner withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SettingInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SettingInner.java new file mode 100644 index 000000000000..11fea10b0530 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SettingInner.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.models.AlertSyncSettings; +import com.azure.resourcemanager.security.models.DataExportSettings; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** The kind of the security setting. */ +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "kind", + defaultImpl = SettingInner.class) +@JsonTypeName("Setting") +@JsonSubTypes({ + @JsonSubTypes.Type(name = "DataExportSettings", value = DataExportSettings.class), + @JsonSubTypes.Type(name = "AlertSyncSettings", value = AlertSyncSettings.class) +}) +@Immutable +public class SettingInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SettingInner.class); + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SoftwareInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SoftwareInner.java new file mode 100644 index 000000000000..e611818a66c0 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SoftwareInner.java @@ -0,0 +1,262 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.models.EndOfSupportStatus; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Represents a software data. */ +@JsonFlatten +@Fluent +public class SoftwareInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SoftwareInner.class); + + /* + * Unique identifier for the virtual machine in the service. + */ + @JsonProperty(value = "properties.deviceId") + private String deviceId; + + /* + * Platform of the operating system running on the device. + */ + @JsonProperty(value = "properties.osPlatform") + private String osPlatform; + + /* + * Name of the software vendor. + */ + @JsonProperty(value = "properties.vendor") + private String vendor; + + /* + * Name of the software product. + */ + @JsonProperty(value = "properties.softwareName") + private String softwareName; + + /* + * Version number of the software product. + */ + @JsonProperty(value = "properties.version") + private String version; + + /* + * End of support status. + */ + @JsonProperty(value = "properties.endOfSupportStatus") + private EndOfSupportStatus endOfSupportStatus; + + /* + * The end of support date in case the product is upcoming end of support. + */ + @JsonProperty(value = "properties.endOfSupportDate") + private String endOfSupportDate; + + /* + * Number of weaknesses. + */ + @JsonProperty(value = "properties.numberOfKnownVulnerabilities") + private Integer numberOfKnownVulnerabilities; + + /* + * First time that the software was seen in the device. + */ + @JsonProperty(value = "properties.firstSeenAt") + private String firstSeenAt; + + /** + * Get the deviceId property: Unique identifier for the virtual machine in the service. + * + * @return the deviceId value. + */ + public String deviceId() { + return this.deviceId; + } + + /** + * Set the deviceId property: Unique identifier for the virtual machine in the service. + * + * @param deviceId the deviceId value to set. + * @return the SoftwareInner object itself. + */ + public SoftwareInner withDeviceId(String deviceId) { + this.deviceId = deviceId; + return this; + } + + /** + * Get the osPlatform property: Platform of the operating system running on the device. + * + * @return the osPlatform value. + */ + public String osPlatform() { + return this.osPlatform; + } + + /** + * Set the osPlatform property: Platform of the operating system running on the device. + * + * @param osPlatform the osPlatform value to set. + * @return the SoftwareInner object itself. + */ + public SoftwareInner withOsPlatform(String osPlatform) { + this.osPlatform = osPlatform; + return this; + } + + /** + * Get the vendor property: Name of the software vendor. + * + * @return the vendor value. + */ + public String vendor() { + return this.vendor; + } + + /** + * Set the vendor property: Name of the software vendor. + * + * @param vendor the vendor value to set. + * @return the SoftwareInner object itself. + */ + public SoftwareInner withVendor(String vendor) { + this.vendor = vendor; + return this; + } + + /** + * Get the softwareName property: Name of the software product. + * + * @return the softwareName value. + */ + public String softwareName() { + return this.softwareName; + } + + /** + * Set the softwareName property: Name of the software product. + * + * @param softwareName the softwareName value to set. + * @return the SoftwareInner object itself. + */ + public SoftwareInner withSoftwareName(String softwareName) { + this.softwareName = softwareName; + return this; + } + + /** + * Get the version property: Version number of the software product. + * + * @return the version value. + */ + public String version() { + return this.version; + } + + /** + * Set the version property: Version number of the software product. + * + * @param version the version value to set. + * @return the SoftwareInner object itself. + */ + public SoftwareInner withVersion(String version) { + this.version = version; + return this; + } + + /** + * Get the endOfSupportStatus property: End of support status. + * + * @return the endOfSupportStatus value. + */ + public EndOfSupportStatus endOfSupportStatus() { + return this.endOfSupportStatus; + } + + /** + * Set the endOfSupportStatus property: End of support status. + * + * @param endOfSupportStatus the endOfSupportStatus value to set. + * @return the SoftwareInner object itself. + */ + public SoftwareInner withEndOfSupportStatus(EndOfSupportStatus endOfSupportStatus) { + this.endOfSupportStatus = endOfSupportStatus; + return this; + } + + /** + * Get the endOfSupportDate property: The end of support date in case the product is upcoming end of support. + * + * @return the endOfSupportDate value. + */ + public String endOfSupportDate() { + return this.endOfSupportDate; + } + + /** + * Set the endOfSupportDate property: The end of support date in case the product is upcoming end of support. + * + * @param endOfSupportDate the endOfSupportDate value to set. + * @return the SoftwareInner object itself. + */ + public SoftwareInner withEndOfSupportDate(String endOfSupportDate) { + this.endOfSupportDate = endOfSupportDate; + return this; + } + + /** + * Get the numberOfKnownVulnerabilities property: Number of weaknesses. + * + * @return the numberOfKnownVulnerabilities value. + */ + public Integer numberOfKnownVulnerabilities() { + return this.numberOfKnownVulnerabilities; + } + + /** + * Set the numberOfKnownVulnerabilities property: Number of weaknesses. + * + * @param numberOfKnownVulnerabilities the numberOfKnownVulnerabilities value to set. + * @return the SoftwareInner object itself. + */ + public SoftwareInner withNumberOfKnownVulnerabilities(Integer numberOfKnownVulnerabilities) { + this.numberOfKnownVulnerabilities = numberOfKnownVulnerabilities; + return this; + } + + /** + * Get the firstSeenAt property: First time that the software was seen in the device. + * + * @return the firstSeenAt value. + */ + public String firstSeenAt() { + return this.firstSeenAt; + } + + /** + * Set the firstSeenAt property: First time that the software was seen in the device. + * + * @param firstSeenAt the firstSeenAt value to set. + * @return the SoftwareInner object itself. + */ + public SoftwareInner withFirstSeenAt(String firstSeenAt) { + this.firstSeenAt = firstSeenAt; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/TopologyResourceInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/TopologyResourceInner.java new file mode 100644 index 000000000000..3bfee519e2c3 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/TopologyResourceInner.java @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.models.TopologySingleResource; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** The TopologyResource model. */ +@JsonFlatten +@Immutable +public class TopologyResourceInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TopologyResourceInner.class); + + /* + * The UTC time on which the topology was calculated + */ + @JsonProperty(value = "properties.calculatedDateTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime calculatedDateTime; + + /* + * Azure resources which are part of this topology resource + */ + @JsonProperty(value = "properties.topologyResources", access = JsonProperty.Access.WRITE_ONLY) + private List topologyResources; + + /* + * Location where the resource is stored + */ + @JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY) + private String location; + + /** + * Get the calculatedDateTime property: The UTC time on which the topology was calculated. + * + * @return the calculatedDateTime value. + */ + public OffsetDateTime calculatedDateTime() { + return this.calculatedDateTime; + } + + /** + * Get the topologyResources property: Azure resources which are part of this topology resource. + * + * @return the topologyResources value. + */ + public List topologyResources() { + return this.topologyResources; + } + + /** + * Get the location property: Location where the resource is stored. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (topologyResources() != null) { + topologyResources().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/WorkspaceSettingInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/WorkspaceSettingInner.java new file mode 100644 index 000000000000..cb05d4a43e9a --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/WorkspaceSettingInner.java @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Configures where to store the OMS agent data for workspaces under a scope. */ +@JsonFlatten +@Fluent +public class WorkspaceSettingInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(WorkspaceSettingInner.class); + + /* + * The full Azure ID of the workspace to save the data in + */ + @JsonProperty(value = "properties.workspaceId") + private String workspaceId; + + /* + * All the VMs in this scope will send their security data to the mentioned + * workspace unless overridden by a setting with more specific scope + */ + @JsonProperty(value = "properties.scope") + private String scope; + + /** + * Get the workspaceId property: The full Azure ID of the workspace to save the data in. + * + * @return the workspaceId value. + */ + public String workspaceId() { + return this.workspaceId; + } + + /** + * Set the workspaceId property: The full Azure ID of the workspace to save the data in. + * + * @param workspaceId the workspaceId value to set. + * @return the WorkspaceSettingInner object itself. + */ + public WorkspaceSettingInner withWorkspaceId(String workspaceId) { + this.workspaceId = workspaceId; + return this; + } + + /** + * Get the scope property: All the VMs in this scope will send their security data to the mentioned workspace unless + * overridden by a setting with more specific scope. + * + * @return the scope value. + */ + public String scope() { + return this.scope; + } + + /** + * Set the scope property: All the VMs in this scope will send their security data to the mentioned workspace unless + * overridden by a setting with more specific scope. + * + * @param scope the scope value to set. + * @return the WorkspaceSettingInner object itself. + */ + public WorkspaceSettingInner withScope(String scope) { + this.scope = scope; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/package-info.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/package-info.java new file mode 100644 index 000000000000..c572ad42092c --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the inner data models for SecurityCenter. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ +package com.azure.resourcemanager.security.fluent.models; diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/package-info.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/package-info.java new file mode 100644 index 000000000000..e13426491bd0 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the service clients for SecurityCenter. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ +package com.azure.resourcemanager.security.fluent; diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AdaptiveApplicationControlGroupImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AdaptiveApplicationControlGroupImpl.java new file mode 100644 index 000000000000..c9bc9b6d36be --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AdaptiveApplicationControlGroupImpl.java @@ -0,0 +1,217 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.AdaptiveApplicationControlGroupInner; +import com.azure.resourcemanager.security.models.AdaptiveApplicationControlGroup; +import com.azure.resourcemanager.security.models.AdaptiveApplicationControlIssueSummary; +import com.azure.resourcemanager.security.models.ConfigurationStatus; +import com.azure.resourcemanager.security.models.EnforcementMode; +import com.azure.resourcemanager.security.models.PathRecommendation; +import com.azure.resourcemanager.security.models.ProtectionMode; +import com.azure.resourcemanager.security.models.RecommendationStatus; +import com.azure.resourcemanager.security.models.SourceSystem; +import com.azure.resourcemanager.security.models.VmRecommendation; +import java.util.Collections; +import java.util.List; + +public final class AdaptiveApplicationControlGroupImpl + implements AdaptiveApplicationControlGroup, + AdaptiveApplicationControlGroup.Definition, + AdaptiveApplicationControlGroup.Update { + private AdaptiveApplicationControlGroupInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public EnforcementMode enforcementMode() { + return this.innerModel().enforcementMode(); + } + + public ProtectionMode protectionMode() { + return this.innerModel().protectionMode(); + } + + public ConfigurationStatus configurationStatus() { + return this.innerModel().configurationStatus(); + } + + public RecommendationStatus recommendationStatus() { + return this.innerModel().recommendationStatus(); + } + + public List issues() { + List inner = this.innerModel().issues(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public SourceSystem sourceSystem() { + return this.innerModel().sourceSystem(); + } + + public List vmRecommendations() { + List inner = this.innerModel().vmRecommendations(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List pathRecommendations() { + List inner = this.innerModel().pathRecommendations(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public String location() { + return this.innerModel().location(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public AdaptiveApplicationControlGroupInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } + + private String ascLocation; + + private String groupName; + + public AdaptiveApplicationControlGroupImpl withExistingLocation(String ascLocation) { + this.ascLocation = ascLocation; + return this; + } + + public AdaptiveApplicationControlGroup create() { + this.innerObject = + serviceManager + .serviceClient() + .getAdaptiveApplicationControls() + .putWithResponse(ascLocation, groupName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public AdaptiveApplicationControlGroup create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getAdaptiveApplicationControls() + .putWithResponse(ascLocation, groupName, this.innerModel(), context) + .getValue(); + return this; + } + + AdaptiveApplicationControlGroupImpl( + String name, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = new AdaptiveApplicationControlGroupInner(); + this.serviceManager = serviceManager; + this.groupName = name; + } + + public AdaptiveApplicationControlGroupImpl update() { + return this; + } + + public AdaptiveApplicationControlGroup apply() { + this.innerObject = + serviceManager + .serviceClient() + .getAdaptiveApplicationControls() + .putWithResponse(ascLocation, groupName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public AdaptiveApplicationControlGroup apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getAdaptiveApplicationControls() + .putWithResponse(ascLocation, groupName, this.innerModel(), context) + .getValue(); + return this; + } + + AdaptiveApplicationControlGroupImpl( + AdaptiveApplicationControlGroupInner innerObject, + com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.ascLocation = Utils.getValueFromIdByName(innerObject.id(), "locations"); + this.groupName = Utils.getValueFromIdByName(innerObject.id(), "applicationWhitelistings"); + } + + public AdaptiveApplicationControlGroup refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getAdaptiveApplicationControls() + .getWithResponse(ascLocation, groupName, Context.NONE) + .getValue(); + return this; + } + + public AdaptiveApplicationControlGroup refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getAdaptiveApplicationControls() + .getWithResponse(ascLocation, groupName, context) + .getValue(); + return this; + } + + public AdaptiveApplicationControlGroupImpl withEnforcementMode(EnforcementMode enforcementMode) { + this.innerModel().withEnforcementMode(enforcementMode); + return this; + } + + public AdaptiveApplicationControlGroupImpl withProtectionMode(ProtectionMode protectionMode) { + this.innerModel().withProtectionMode(protectionMode); + return this; + } + + public AdaptiveApplicationControlGroupImpl withVmRecommendations(List vmRecommendations) { + this.innerModel().withVmRecommendations(vmRecommendations); + return this; + } + + public AdaptiveApplicationControlGroupImpl withPathRecommendations(List pathRecommendations) { + this.innerModel().withPathRecommendations(pathRecommendations); + return this; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AdaptiveApplicationControlGroupsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AdaptiveApplicationControlGroupsImpl.java new file mode 100644 index 000000000000..ed7a53c75298 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AdaptiveApplicationControlGroupsImpl.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.resourcemanager.security.fluent.models.AdaptiveApplicationControlGroupInner; +import com.azure.resourcemanager.security.fluent.models.AdaptiveApplicationControlGroupsInner; +import com.azure.resourcemanager.security.models.AdaptiveApplicationControlGroup; +import com.azure.resourcemanager.security.models.AdaptiveApplicationControlGroups; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +public final class AdaptiveApplicationControlGroupsImpl implements AdaptiveApplicationControlGroups { + private AdaptiveApplicationControlGroupsInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + AdaptiveApplicationControlGroupsImpl( + AdaptiveApplicationControlGroupsInner innerObject, + com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public List value() { + List inner = this.innerModel().value(); + if (inner != null) { + return Collections + .unmodifiableList( + inner + .stream() + .map(inner1 -> new AdaptiveApplicationControlGroupImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return Collections.emptyList(); + } + } + + public AdaptiveApplicationControlGroupsInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AdaptiveApplicationControlsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AdaptiveApplicationControlsClientImpl.java new file mode 100644 index 000000000000..7a1dc2068cc3 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AdaptiveApplicationControlsClientImpl.java @@ -0,0 +1,749 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.AdaptiveApplicationControlsClient; +import com.azure.resourcemanager.security.fluent.models.AdaptiveApplicationControlGroupInner; +import com.azure.resourcemanager.security.fluent.models.AdaptiveApplicationControlGroupsInner; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in AdaptiveApplicationControlsClient. */ +public final class AdaptiveApplicationControlsClientImpl implements AdaptiveApplicationControlsClient { + private final ClientLogger logger = new ClientLogger(AdaptiveApplicationControlsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final AdaptiveApplicationControlsService service; + + /** The service client containing this operation class. */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of AdaptiveApplicationControlsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + AdaptiveApplicationControlsClientImpl(SecurityCenterImpl client) { + this.service = + RestProxy + .create( + AdaptiveApplicationControlsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterAdaptiveApplicationControls to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityCenterAdapti") + private interface AdaptiveApplicationControlsService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/applicationWhitelistings") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @QueryParam("includePathRecommendations") Boolean includePathRecommendations, + @QueryParam("summary") Boolean summary, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}" + + "/applicationWhitelistings/{groupName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("ascLocation") String ascLocation, + @PathParam("groupName") String groupName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}" + + "/applicationWhitelistings/{groupName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> put( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("ascLocation") String ascLocation, + @PathParam("groupName") String groupName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") AdaptiveApplicationControlGroupInner body, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}" + + "/applicationWhitelistings/{groupName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("ascLocation") String ascLocation, + @PathParam("groupName") String groupName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a list of application control machine groups for the subscription. + * + * @param includePathRecommendations Include the policy rules. + * @param summary Return output in a summarized form. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of application control machine groups for the subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listWithResponseAsync( + Boolean includePathRecommendations, Boolean summary) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + apiVersion, + includePathRecommendations, + summary, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of application control machine groups for the subscription. + * + * @param includePathRecommendations Include the policy rules. + * @param summary Return output in a summarized form. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of application control machine groups for the subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listWithResponseAsync( + Boolean includePathRecommendations, Boolean summary, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + apiVersion, + includePathRecommendations, + summary, + accept, + context); + } + + /** + * Gets a list of application control machine groups for the subscription. + * + * @param includePathRecommendations Include the policy rules. + * @param summary Return output in a summarized form. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of application control machine groups for the subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listAsync(Boolean includePathRecommendations, Boolean summary) { + return listWithResponseAsync(includePathRecommendations, summary) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a list of application control machine groups for the subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of application control machine groups for the subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listAsync() { + final Boolean includePathRecommendations = null; + final Boolean summary = null; + return listWithResponseAsync(includePathRecommendations, summary) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a list of application control machine groups for the subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of application control machine groups for the subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AdaptiveApplicationControlGroupsInner list() { + final Boolean includePathRecommendations = null; + final Boolean summary = null; + return listAsync(includePathRecommendations, summary).block(); + } + + /** + * Gets a list of application control machine groups for the subscription. + * + * @param includePathRecommendations Include the policy rules. + * @param summary Return output in a summarized form. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of application control machine groups for the subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listWithResponse( + Boolean includePathRecommendations, Boolean summary, Context context) { + return listWithResponseAsync(includePathRecommendations, summary, context).block(); + } + + /** + * Gets an application control VM/server group. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param groupName Name of an application control machine group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an application control VM/server group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String ascLocation, String groupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (ascLocation == null) { + return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + if (groupName == null) { + return Mono.error(new IllegalArgumentException("Parameter groupName is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + ascLocation, + groupName, + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets an application control VM/server group. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param groupName Name of an application control machine group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an application control VM/server group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String ascLocation, String groupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (ascLocation == null) { + return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + if (groupName == null) { + return Mono.error(new IllegalArgumentException("Parameter groupName is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + ascLocation, + groupName, + apiVersion, + accept, + context); + } + + /** + * Gets an application control VM/server group. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param groupName Name of an application control machine group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an application control VM/server group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String ascLocation, String groupName) { + return getWithResponseAsync(ascLocation, groupName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets an application control VM/server group. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param groupName Name of an application control machine group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an application control VM/server group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AdaptiveApplicationControlGroupInner get(String ascLocation, String groupName) { + return getAsync(ascLocation, groupName).block(); + } + + /** + * Gets an application control VM/server group. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param groupName Name of an application control machine group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an application control VM/server group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String ascLocation, String groupName, Context context) { + return getWithResponseAsync(ascLocation, groupName, context).block(); + } + + /** + * Update an application control machine group. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param groupName Name of an application control machine group. + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> putWithResponseAsync( + String ascLocation, String groupName, AdaptiveApplicationControlGroupInner body) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (ascLocation == null) { + return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + if (groupName == null) { + return Mono.error(new IllegalArgumentException("Parameter groupName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .put( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + ascLocation, + groupName, + apiVersion, + body, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update an application control machine group. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param groupName Name of an application control machine group. + * @param body The body parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> putWithResponseAsync( + String ascLocation, String groupName, AdaptiveApplicationControlGroupInner body, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (ascLocation == null) { + return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + if (groupName == null) { + return Mono.error(new IllegalArgumentException("Parameter groupName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .put( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + ascLocation, + groupName, + apiVersion, + body, + accept, + context); + } + + /** + * Update an application control machine group. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param groupName Name of an application control machine group. + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono putAsync( + String ascLocation, String groupName, AdaptiveApplicationControlGroupInner body) { + return putWithResponseAsync(ascLocation, groupName, body) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Update an application control machine group. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param groupName Name of an application control machine group. + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AdaptiveApplicationControlGroupInner put( + String ascLocation, String groupName, AdaptiveApplicationControlGroupInner body) { + return putAsync(ascLocation, groupName, body).block(); + } + + /** + * Update an application control machine group. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param groupName Name of an application control machine group. + * @param body The body parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse( + String ascLocation, String groupName, AdaptiveApplicationControlGroupInner body, Context context) { + return putWithResponseAsync(ascLocation, groupName, body, context).block(); + } + + /** + * Delete an application control machine group. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param groupName Name of an application control machine group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String ascLocation, String groupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (ascLocation == null) { + return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + if (groupName == null) { + return Mono.error(new IllegalArgumentException("Parameter groupName is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + ascLocation, + groupName, + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete an application control machine group. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param groupName Name of an application control machine group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String ascLocation, String groupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (ascLocation == null) { + return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + if (groupName == null) { + return Mono.error(new IllegalArgumentException("Parameter groupName is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + ascLocation, + groupName, + apiVersion, + accept, + context); + } + + /** + * Delete an application control machine group. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param groupName Name of an application control machine group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String ascLocation, String groupName) { + return deleteWithResponseAsync(ascLocation, groupName).flatMap((Response res) -> Mono.empty()); + } + + /** + * Delete an application control machine group. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param groupName Name of an application control machine group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String ascLocation, String groupName) { + deleteAsync(ascLocation, groupName).block(); + } + + /** + * Delete an application control machine group. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param groupName Name of an application control machine group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String ascLocation, String groupName, Context context) { + return deleteWithResponseAsync(ascLocation, groupName, context).block(); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AdaptiveApplicationControlsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AdaptiveApplicationControlsImpl.java new file mode 100644 index 000000000000..3908d6084e7b --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AdaptiveApplicationControlsImpl.java @@ -0,0 +1,184 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.AdaptiveApplicationControlsClient; +import com.azure.resourcemanager.security.fluent.models.AdaptiveApplicationControlGroupInner; +import com.azure.resourcemanager.security.fluent.models.AdaptiveApplicationControlGroupsInner; +import com.azure.resourcemanager.security.models.AdaptiveApplicationControlGroup; +import com.azure.resourcemanager.security.models.AdaptiveApplicationControlGroups; +import com.azure.resourcemanager.security.models.AdaptiveApplicationControls; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class AdaptiveApplicationControlsImpl implements AdaptiveApplicationControls { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AdaptiveApplicationControlsImpl.class); + + private final AdaptiveApplicationControlsClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public AdaptiveApplicationControlsImpl( + AdaptiveApplicationControlsClient innerClient, + com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public AdaptiveApplicationControlGroups list() { + AdaptiveApplicationControlGroupsInner inner = this.serviceClient().list(); + if (inner != null) { + return new AdaptiveApplicationControlGroupsImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response listWithResponse( + Boolean includePathRecommendations, Boolean summary, Context context) { + Response inner = + this.serviceClient().listWithResponse(includePathRecommendations, summary, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new AdaptiveApplicationControlGroupsImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public AdaptiveApplicationControlGroup get(String ascLocation, String groupName) { + AdaptiveApplicationControlGroupInner inner = this.serviceClient().get(ascLocation, groupName); + if (inner != null) { + return new AdaptiveApplicationControlGroupImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String ascLocation, String groupName, Context context) { + Response inner = + this.serviceClient().getWithResponse(ascLocation, groupName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new AdaptiveApplicationControlGroupImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deleteByResourceGroup(String ascLocation, String groupName) { + this.serviceClient().delete(ascLocation, groupName); + } + + public Response deleteWithResponse(String ascLocation, String groupName, Context context) { + return this.serviceClient().deleteWithResponse(ascLocation, groupName, context); + } + + public AdaptiveApplicationControlGroup getById(String id) { + String ascLocation = Utils.getValueFromIdByName(id, "locations"); + if (ascLocation == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'locations'.", id))); + } + String groupName = Utils.getValueFromIdByName(id, "applicationWhitelistings"); + if (groupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'applicationWhitelistings'.", + id))); + } + return this.getWithResponse(ascLocation, groupName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String ascLocation = Utils.getValueFromIdByName(id, "locations"); + if (ascLocation == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'locations'.", id))); + } + String groupName = Utils.getValueFromIdByName(id, "applicationWhitelistings"); + if (groupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'applicationWhitelistings'.", + id))); + } + return this.getWithResponse(ascLocation, groupName, context); + } + + public void deleteById(String id) { + String ascLocation = Utils.getValueFromIdByName(id, "locations"); + if (ascLocation == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'locations'.", id))); + } + String groupName = Utils.getValueFromIdByName(id, "applicationWhitelistings"); + if (groupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'applicationWhitelistings'.", + id))); + } + this.deleteWithResponse(ascLocation, groupName, Context.NONE).getValue(); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String ascLocation = Utils.getValueFromIdByName(id, "locations"); + if (ascLocation == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'locations'.", id))); + } + String groupName = Utils.getValueFromIdByName(id, "applicationWhitelistings"); + if (groupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'applicationWhitelistings'.", + id))); + } + return this.deleteWithResponse(ascLocation, groupName, context); + } + + private AdaptiveApplicationControlsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } + + public AdaptiveApplicationControlGroupImpl define(String name) { + return new AdaptiveApplicationControlGroupImpl(name, this.manager()); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AdaptiveNetworkHardeningImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AdaptiveNetworkHardeningImpl.java new file mode 100644 index 000000000000..c07af0ebfddc --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AdaptiveNetworkHardeningImpl.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.resourcemanager.security.fluent.models.AdaptiveNetworkHardeningInner; +import com.azure.resourcemanager.security.models.AdaptiveNetworkHardening; +import com.azure.resourcemanager.security.models.EffectiveNetworkSecurityGroups; +import com.azure.resourcemanager.security.models.Rule; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; + +public final class AdaptiveNetworkHardeningImpl implements AdaptiveNetworkHardening { + private AdaptiveNetworkHardeningInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + AdaptiveNetworkHardeningImpl( + AdaptiveNetworkHardeningInner innerObject, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public List rules() { + List inner = this.innerModel().rules(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public OffsetDateTime rulesCalculationTime() { + return this.innerModel().rulesCalculationTime(); + } + + public List effectiveNetworkSecurityGroups() { + List inner = this.innerModel().effectiveNetworkSecurityGroups(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public AdaptiveNetworkHardeningInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AdaptiveNetworkHardeningsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AdaptiveNetworkHardeningsClientImpl.java new file mode 100644 index 000000000000..ea098b6e794a --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AdaptiveNetworkHardeningsClientImpl.java @@ -0,0 +1,1123 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.security.fluent.AdaptiveNetworkHardeningsClient; +import com.azure.resourcemanager.security.fluent.models.AdaptiveNetworkHardeningInner; +import com.azure.resourcemanager.security.models.AdaptiveNetworkHardeningEnforceRequest; +import com.azure.resourcemanager.security.models.AdaptiveNetworkHardeningsList; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in AdaptiveNetworkHardeningsClient. */ +public final class AdaptiveNetworkHardeningsClientImpl implements AdaptiveNetworkHardeningsClient { + private final ClientLogger logger = new ClientLogger(AdaptiveNetworkHardeningsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final AdaptiveNetworkHardeningsService service; + + /** The service client containing this operation class. */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of AdaptiveNetworkHardeningsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + AdaptiveNetworkHardeningsClientImpl(SecurityCenterImpl client) { + this.service = + RestProxy + .create( + AdaptiveNetworkHardeningsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterAdaptiveNetworkHardenings to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityCenterAdapti") + private interface AdaptiveNetworkHardeningsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}" + + "/{resourceType}/{resourceName}/providers/Microsoft.Security/adaptiveNetworkHardenings") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByExtendedResource( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("resourceNamespace") String resourceNamespace, + @PathParam("resourceType") String resourceType, + @PathParam("resourceName") String resourceName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}" + + "/{resourceType}/{resourceName}/providers/Microsoft.Security/adaptiveNetworkHardenings" + + "/{adaptiveNetworkHardeningResourceName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("resourceNamespace") String resourceNamespace, + @PathParam("resourceType") String resourceType, + @PathParam("resourceName") String resourceName, + @PathParam("adaptiveNetworkHardeningResourceName") String adaptiveNetworkHardeningResourceName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}" + + "/{resourceType}/{resourceName}/providers/Microsoft.Security/adaptiveNetworkHardenings" + + "/{adaptiveNetworkHardeningResourceName}/{adaptiveNetworkHardeningEnforceAction}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> enforce( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("resourceNamespace") String resourceNamespace, + @PathParam("resourceType") String resourceType, + @PathParam("resourceName") String resourceName, + @PathParam("adaptiveNetworkHardeningResourceName") String adaptiveNetworkHardeningResourceName, + @PathParam("adaptiveNetworkHardeningEnforceAction") String adaptiveNetworkHardeningEnforceAction, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") AdaptiveNetworkHardeningEnforceRequest body, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByExtendedResourceNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a list of Adaptive Network Hardenings resources in scope of an extended resource. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Adaptive Network Hardenings resources in scope of an extended resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByExtendedResourceSinglePageAsync( + String resourceGroupName, String resourceNamespace, String resourceType, String resourceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourceNamespace == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceNamespace is required and cannot be null.")); + } + if (resourceType == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceType is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByExtendedResource( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceNamespace, + resourceType, + resourceName, + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of Adaptive Network Hardenings resources in scope of an extended resource. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Adaptive Network Hardenings resources in scope of an extended resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByExtendedResourceSinglePageAsync( + String resourceGroupName, String resourceNamespace, String resourceType, String resourceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourceNamespace == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceNamespace is required and cannot be null.")); + } + if (resourceType == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceType is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByExtendedResource( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceNamespace, + resourceType, + resourceName, + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a list of Adaptive Network Hardenings resources in scope of an extended resource. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Adaptive Network Hardenings resources in scope of an extended resource. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByExtendedResourceAsync( + String resourceGroupName, String resourceNamespace, String resourceType, String resourceName) { + return new PagedFlux<>( + () -> + listByExtendedResourceSinglePageAsync(resourceGroupName, resourceNamespace, resourceType, resourceName), + nextLink -> listByExtendedResourceNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of Adaptive Network Hardenings resources in scope of an extended resource. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Adaptive Network Hardenings resources in scope of an extended resource. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByExtendedResourceAsync( + String resourceGroupName, String resourceNamespace, String resourceType, String resourceName, Context context) { + return new PagedFlux<>( + () -> + listByExtendedResourceSinglePageAsync( + resourceGroupName, resourceNamespace, resourceType, resourceName, context), + nextLink -> listByExtendedResourceNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list of Adaptive Network Hardenings resources in scope of an extended resource. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Adaptive Network Hardenings resources in scope of an extended resource. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByExtendedResource( + String resourceGroupName, String resourceNamespace, String resourceType, String resourceName) { + return new PagedIterable<>( + listByExtendedResourceAsync(resourceGroupName, resourceNamespace, resourceType, resourceName)); + } + + /** + * Gets a list of Adaptive Network Hardenings resources in scope of an extended resource. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Adaptive Network Hardenings resources in scope of an extended resource. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByExtendedResource( + String resourceGroupName, String resourceNamespace, String resourceType, String resourceName, Context context) { + return new PagedIterable<>( + listByExtendedResourceAsync(resourceGroupName, resourceNamespace, resourceType, resourceName, context)); + } + + /** + * Gets a single Adaptive Network Hardening resource. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @param adaptiveNetworkHardeningResourceName The name of the Adaptive Network Hardening resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a single Adaptive Network Hardening resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String resourceNamespace, + String resourceType, + String resourceName, + String adaptiveNetworkHardeningResourceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourceNamespace == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceNamespace is required and cannot be null.")); + } + if (resourceType == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceType is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + if (adaptiveNetworkHardeningResourceName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter adaptiveNetworkHardeningResourceName is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceNamespace, + resourceType, + resourceName, + adaptiveNetworkHardeningResourceName, + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a single Adaptive Network Hardening resource. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @param adaptiveNetworkHardeningResourceName The name of the Adaptive Network Hardening resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a single Adaptive Network Hardening resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String resourceNamespace, + String resourceType, + String resourceName, + String adaptiveNetworkHardeningResourceName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourceNamespace == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceNamespace is required and cannot be null.")); + } + if (resourceType == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceType is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + if (adaptiveNetworkHardeningResourceName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter adaptiveNetworkHardeningResourceName is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceNamespace, + resourceType, + resourceName, + adaptiveNetworkHardeningResourceName, + apiVersion, + accept, + context); + } + + /** + * Gets a single Adaptive Network Hardening resource. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @param adaptiveNetworkHardeningResourceName The name of the Adaptive Network Hardening resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a single Adaptive Network Hardening resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, + String resourceNamespace, + String resourceType, + String resourceName, + String adaptiveNetworkHardeningResourceName) { + return getWithResponseAsync( + resourceGroupName, resourceNamespace, resourceType, resourceName, adaptiveNetworkHardeningResourceName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a single Adaptive Network Hardening resource. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @param adaptiveNetworkHardeningResourceName The name of the Adaptive Network Hardening resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a single Adaptive Network Hardening resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AdaptiveNetworkHardeningInner get( + String resourceGroupName, + String resourceNamespace, + String resourceType, + String resourceName, + String adaptiveNetworkHardeningResourceName) { + return getAsync( + resourceGroupName, resourceNamespace, resourceType, resourceName, adaptiveNetworkHardeningResourceName) + .block(); + } + + /** + * Gets a single Adaptive Network Hardening resource. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @param adaptiveNetworkHardeningResourceName The name of the Adaptive Network Hardening resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a single Adaptive Network Hardening resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String resourceNamespace, + String resourceType, + String resourceName, + String adaptiveNetworkHardeningResourceName, + Context context) { + return getWithResponseAsync( + resourceGroupName, + resourceNamespace, + resourceType, + resourceName, + adaptiveNetworkHardeningResourceName, + context) + .block(); + } + + /** + * Enforces the given rules on the NSG(s) listed in the request. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @param adaptiveNetworkHardeningResourceName The name of the Adaptive Network Hardening resource. + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> enforceWithResponseAsync( + String resourceGroupName, + String resourceNamespace, + String resourceType, + String resourceName, + String adaptiveNetworkHardeningResourceName, + AdaptiveNetworkHardeningEnforceRequest body) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourceNamespace == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceNamespace is required and cannot be null.")); + } + if (resourceType == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceType is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + if (adaptiveNetworkHardeningResourceName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter adaptiveNetworkHardeningResourceName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String adaptiveNetworkHardeningEnforceAction = "enforce"; + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .enforce( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceNamespace, + resourceType, + resourceName, + adaptiveNetworkHardeningResourceName, + adaptiveNetworkHardeningEnforceAction, + apiVersion, + body, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Enforces the given rules on the NSG(s) listed in the request. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @param adaptiveNetworkHardeningResourceName The name of the Adaptive Network Hardening resource. + * @param body The body parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> enforceWithResponseAsync( + String resourceGroupName, + String resourceNamespace, + String resourceType, + String resourceName, + String adaptiveNetworkHardeningResourceName, + AdaptiveNetworkHardeningEnforceRequest body, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourceNamespace == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceNamespace is required and cannot be null.")); + } + if (resourceType == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceType is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + if (adaptiveNetworkHardeningResourceName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter adaptiveNetworkHardeningResourceName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String adaptiveNetworkHardeningEnforceAction = "enforce"; + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .enforce( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceNamespace, + resourceType, + resourceName, + adaptiveNetworkHardeningResourceName, + adaptiveNetworkHardeningEnforceAction, + apiVersion, + body, + accept, + context); + } + + /** + * Enforces the given rules on the NSG(s) listed in the request. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @param adaptiveNetworkHardeningResourceName The name of the Adaptive Network Hardening resource. + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginEnforceAsync( + String resourceGroupName, + String resourceNamespace, + String resourceType, + String resourceName, + String adaptiveNetworkHardeningResourceName, + AdaptiveNetworkHardeningEnforceRequest body) { + Mono>> mono = + enforceWithResponseAsync( + resourceGroupName, + resourceNamespace, + resourceType, + resourceName, + adaptiveNetworkHardeningResourceName, + body); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Enforces the given rules on the NSG(s) listed in the request. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @param adaptiveNetworkHardeningResourceName The name of the Adaptive Network Hardening resource. + * @param body The body parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginEnforceAsync( + String resourceGroupName, + String resourceNamespace, + String resourceType, + String resourceName, + String adaptiveNetworkHardeningResourceName, + AdaptiveNetworkHardeningEnforceRequest body, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + enforceWithResponseAsync( + resourceGroupName, + resourceNamespace, + resourceType, + resourceName, + adaptiveNetworkHardeningResourceName, + body, + context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Enforces the given rules on the NSG(s) listed in the request. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @param adaptiveNetworkHardeningResourceName The name of the Adaptive Network Hardening resource. + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginEnforce( + String resourceGroupName, + String resourceNamespace, + String resourceType, + String resourceName, + String adaptiveNetworkHardeningResourceName, + AdaptiveNetworkHardeningEnforceRequest body) { + return beginEnforceAsync( + resourceGroupName, + resourceNamespace, + resourceType, + resourceName, + adaptiveNetworkHardeningResourceName, + body) + .getSyncPoller(); + } + + /** + * Enforces the given rules on the NSG(s) listed in the request. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @param adaptiveNetworkHardeningResourceName The name of the Adaptive Network Hardening resource. + * @param body The body parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginEnforce( + String resourceGroupName, + String resourceNamespace, + String resourceType, + String resourceName, + String adaptiveNetworkHardeningResourceName, + AdaptiveNetworkHardeningEnforceRequest body, + Context context) { + return beginEnforceAsync( + resourceGroupName, + resourceNamespace, + resourceType, + resourceName, + adaptiveNetworkHardeningResourceName, + body, + context) + .getSyncPoller(); + } + + /** + * Enforces the given rules on the NSG(s) listed in the request. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @param adaptiveNetworkHardeningResourceName The name of the Adaptive Network Hardening resource. + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono enforceAsync( + String resourceGroupName, + String resourceNamespace, + String resourceType, + String resourceName, + String adaptiveNetworkHardeningResourceName, + AdaptiveNetworkHardeningEnforceRequest body) { + return beginEnforceAsync( + resourceGroupName, + resourceNamespace, + resourceType, + resourceName, + adaptiveNetworkHardeningResourceName, + body) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Enforces the given rules on the NSG(s) listed in the request. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @param adaptiveNetworkHardeningResourceName The name of the Adaptive Network Hardening resource. + * @param body The body parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono enforceAsync( + String resourceGroupName, + String resourceNamespace, + String resourceType, + String resourceName, + String adaptiveNetworkHardeningResourceName, + AdaptiveNetworkHardeningEnforceRequest body, + Context context) { + return beginEnforceAsync( + resourceGroupName, + resourceNamespace, + resourceType, + resourceName, + adaptiveNetworkHardeningResourceName, + body, + context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Enforces the given rules on the NSG(s) listed in the request. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @param adaptiveNetworkHardeningResourceName The name of the Adaptive Network Hardening resource. + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void enforce( + String resourceGroupName, + String resourceNamespace, + String resourceType, + String resourceName, + String adaptiveNetworkHardeningResourceName, + AdaptiveNetworkHardeningEnforceRequest body) { + enforceAsync( + resourceGroupName, + resourceNamespace, + resourceType, + resourceName, + adaptiveNetworkHardeningResourceName, + body) + .block(); + } + + /** + * Enforces the given rules on the NSG(s) listed in the request. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @param adaptiveNetworkHardeningResourceName The name of the Adaptive Network Hardening resource. + * @param body The body parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void enforce( + String resourceGroupName, + String resourceNamespace, + String resourceType, + String resourceName, + String adaptiveNetworkHardeningResourceName, + AdaptiveNetworkHardeningEnforceRequest body, + Context context) { + enforceAsync( + resourceGroupName, + resourceNamespace, + resourceType, + resourceName, + adaptiveNetworkHardeningResourceName, + body, + context) + .block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response for ListAdaptiveNetworkHardenings API service call. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByExtendedResourceNextSinglePageAsync( + String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByExtendedResourceNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response for ListAdaptiveNetworkHardenings API service call. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByExtendedResourceNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByExtendedResourceNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AdaptiveNetworkHardeningsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AdaptiveNetworkHardeningsImpl.java new file mode 100644 index 000000000000..ea617df9a5b5 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AdaptiveNetworkHardeningsImpl.java @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.AdaptiveNetworkHardeningsClient; +import com.azure.resourcemanager.security.fluent.models.AdaptiveNetworkHardeningInner; +import com.azure.resourcemanager.security.models.AdaptiveNetworkHardening; +import com.azure.resourcemanager.security.models.AdaptiveNetworkHardeningEnforceRequest; +import com.azure.resourcemanager.security.models.AdaptiveNetworkHardenings; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class AdaptiveNetworkHardeningsImpl implements AdaptiveNetworkHardenings { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AdaptiveNetworkHardeningsImpl.class); + + private final AdaptiveNetworkHardeningsClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public AdaptiveNetworkHardeningsImpl( + AdaptiveNetworkHardeningsClient innerClient, + com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByExtendedResource( + String resourceGroupName, String resourceNamespace, String resourceType, String resourceName) { + PagedIterable inner = + this + .serviceClient() + .listByExtendedResource(resourceGroupName, resourceNamespace, resourceType, resourceName); + return Utils.mapPage(inner, inner1 -> new AdaptiveNetworkHardeningImpl(inner1, this.manager())); + } + + public PagedIterable listByExtendedResource( + String resourceGroupName, String resourceNamespace, String resourceType, String resourceName, Context context) { + PagedIterable inner = + this + .serviceClient() + .listByExtendedResource(resourceGroupName, resourceNamespace, resourceType, resourceName, context); + return Utils.mapPage(inner, inner1 -> new AdaptiveNetworkHardeningImpl(inner1, this.manager())); + } + + public AdaptiveNetworkHardening get( + String resourceGroupName, + String resourceNamespace, + String resourceType, + String resourceName, + String adaptiveNetworkHardeningResourceName) { + AdaptiveNetworkHardeningInner inner = + this + .serviceClient() + .get( + resourceGroupName, + resourceNamespace, + resourceType, + resourceName, + adaptiveNetworkHardeningResourceName); + if (inner != null) { + return new AdaptiveNetworkHardeningImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, + String resourceNamespace, + String resourceType, + String resourceName, + String adaptiveNetworkHardeningResourceName, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse( + resourceGroupName, + resourceNamespace, + resourceType, + resourceName, + adaptiveNetworkHardeningResourceName, + context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new AdaptiveNetworkHardeningImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void enforce( + String resourceGroupName, + String resourceNamespace, + String resourceType, + String resourceName, + String adaptiveNetworkHardeningResourceName, + AdaptiveNetworkHardeningEnforceRequest body) { + this + .serviceClient() + .enforce( + resourceGroupName, + resourceNamespace, + resourceType, + resourceName, + adaptiveNetworkHardeningResourceName, + body); + } + + public void enforce( + String resourceGroupName, + String resourceNamespace, + String resourceType, + String resourceName, + String adaptiveNetworkHardeningResourceName, + AdaptiveNetworkHardeningEnforceRequest body, + Context context) { + this + .serviceClient() + .enforce( + resourceGroupName, + resourceNamespace, + resourceType, + resourceName, + adaptiveNetworkHardeningResourceName, + body, + context); + } + + private AdaptiveNetworkHardeningsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AdvancedThreatProtectionSettingImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AdvancedThreatProtectionSettingImpl.java new file mode 100644 index 000000000000..42c6609f6803 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AdvancedThreatProtectionSettingImpl.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.AdvancedThreatProtectionSettingInner; +import com.azure.resourcemanager.security.models.AdvancedThreatProtectionSetting; + +public final class AdvancedThreatProtectionSettingImpl + implements AdvancedThreatProtectionSetting, AdvancedThreatProtectionSetting.Definition { + private AdvancedThreatProtectionSettingInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + AdvancedThreatProtectionSettingImpl( + AdvancedThreatProtectionSettingInner innerObject, + com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public Boolean isEnabled() { + return this.innerModel().isEnabled(); + } + + public AdvancedThreatProtectionSettingInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } + + private String resourceId; + + public AdvancedThreatProtectionSettingImpl withExistingResourceId(String resourceId) { + this.resourceId = resourceId; + return this; + } + + public AdvancedThreatProtectionSetting create() { + this.innerObject = + serviceManager + .serviceClient() + .getAdvancedThreatProtections() + .createWithResponse(resourceId, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public AdvancedThreatProtectionSetting create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getAdvancedThreatProtections() + .createWithResponse(resourceId, this.innerModel(), context) + .getValue(); + return this; + } + + AdvancedThreatProtectionSettingImpl(com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = new AdvancedThreatProtectionSettingInner(); + this.serviceManager = serviceManager; + } + + public AdvancedThreatProtectionSetting refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getAdvancedThreatProtections() + .getWithResponse(resourceId, Context.NONE) + .getValue(); + return this; + } + + public AdvancedThreatProtectionSetting refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getAdvancedThreatProtections() + .getWithResponse(resourceId, context) + .getValue(); + return this; + } + + public AdvancedThreatProtectionSettingImpl withIsEnabled(Boolean isEnabled) { + this.innerModel().withIsEnabled(isEnabled); + return this; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AdvancedThreatProtectionsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AdvancedThreatProtectionsClientImpl.java new file mode 100644 index 000000000000..8f7d8075fe21 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AdvancedThreatProtectionsClientImpl.java @@ -0,0 +1,346 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.AdvancedThreatProtectionsClient; +import com.azure.resourcemanager.security.fluent.models.AdvancedThreatProtectionSettingInner; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in AdvancedThreatProtectionsClient. */ +public final class AdvancedThreatProtectionsClientImpl implements AdvancedThreatProtectionsClient { + private final ClientLogger logger = new ClientLogger(AdvancedThreatProtectionsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final AdvancedThreatProtectionsService service; + + /** The service client containing this operation class. */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of AdvancedThreatProtectionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + AdvancedThreatProtectionsClientImpl(SecurityCenterImpl client) { + this.service = + RestProxy + .create( + AdvancedThreatProtectionsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterAdvancedThreatProtections to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityCenterAdvanc") + private interface AdvancedThreatProtectionsService { + @Headers({"Content-Type: application/json"}) + @Get("/{resourceId}/providers/Microsoft.Security/advancedThreatProtectionSettings/{settingName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceId", encoded = true) String resourceId, + @PathParam("settingName") String settingName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put("/{resourceId}/providers/Microsoft.Security/advancedThreatProtectionSettings/{settingName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> create( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceId", encoded = true) String resourceId, + @PathParam("settingName") String settingName, + @BodyParam("application/json") AdvancedThreatProtectionSettingInner advancedThreatProtectionSetting, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets the Advanced Threat Protection settings for the specified resource. + * + * @param resourceId The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Advanced Threat Protection settings for the specified resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceId == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); + } + final String apiVersion = "2019-01-01"; + final String settingName = "current"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.get(this.client.getEndpoint(), apiVersion, resourceId, settingName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the Advanced Threat Protection settings for the specified resource. + * + * @param resourceId The identifier of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Advanced Threat Protection settings for the specified resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceId == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); + } + final String apiVersion = "2019-01-01"; + final String settingName = "current"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), apiVersion, resourceId, settingName, accept, context); + } + + /** + * Gets the Advanced Threat Protection settings for the specified resource. + * + * @param resourceId The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Advanced Threat Protection settings for the specified resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceId) { + return getWithResponseAsync(resourceId) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the Advanced Threat Protection settings for the specified resource. + * + * @param resourceId The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Advanced Threat Protection settings for the specified resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AdvancedThreatProtectionSettingInner get(String resourceId) { + return getAsync(resourceId).block(); + } + + /** + * Gets the Advanced Threat Protection settings for the specified resource. + * + * @param resourceId The identifier of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Advanced Threat Protection settings for the specified resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceId, Context context) { + return getWithResponseAsync(resourceId, context).block(); + } + + /** + * Creates or updates the Advanced Threat Protection settings on a specified resource. + * + * @param resourceId The identifier of the resource. + * @param advancedThreatProtectionSetting Advanced Threat Protection Settings. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Advanced Threat Protection resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync( + String resourceId, AdvancedThreatProtectionSettingInner advancedThreatProtectionSetting) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceId == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); + } + if (advancedThreatProtectionSetting == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter advancedThreatProtectionSetting is required and cannot be null.")); + } else { + advancedThreatProtectionSetting.validate(); + } + final String apiVersion = "2019-01-01"; + final String settingName = "current"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .create( + this.client.getEndpoint(), + apiVersion, + resourceId, + settingName, + advancedThreatProtectionSetting, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates the Advanced Threat Protection settings on a specified resource. + * + * @param resourceId The identifier of the resource. + * @param advancedThreatProtectionSetting Advanced Threat Protection Settings. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Advanced Threat Protection resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync( + String resourceId, AdvancedThreatProtectionSettingInner advancedThreatProtectionSetting, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceId == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); + } + if (advancedThreatProtectionSetting == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter advancedThreatProtectionSetting is required and cannot be null.")); + } else { + advancedThreatProtectionSetting.validate(); + } + final String apiVersion = "2019-01-01"; + final String settingName = "current"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .create( + this.client.getEndpoint(), + apiVersion, + resourceId, + settingName, + advancedThreatProtectionSetting, + accept, + context); + } + + /** + * Creates or updates the Advanced Threat Protection settings on a specified resource. + * + * @param resourceId The identifier of the resource. + * @param advancedThreatProtectionSetting Advanced Threat Protection Settings. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Advanced Threat Protection resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String resourceId, AdvancedThreatProtectionSettingInner advancedThreatProtectionSetting) { + return createWithResponseAsync(resourceId, advancedThreatProtectionSetting) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Creates or updates the Advanced Threat Protection settings on a specified resource. + * + * @param resourceId The identifier of the resource. + * @param advancedThreatProtectionSetting Advanced Threat Protection Settings. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Advanced Threat Protection resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AdvancedThreatProtectionSettingInner create( + String resourceId, AdvancedThreatProtectionSettingInner advancedThreatProtectionSetting) { + return createAsync(resourceId, advancedThreatProtectionSetting).block(); + } + + /** + * Creates or updates the Advanced Threat Protection settings on a specified resource. + * + * @param resourceId The identifier of the resource. + * @param advancedThreatProtectionSetting Advanced Threat Protection Settings. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Advanced Threat Protection resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createWithResponse( + String resourceId, AdvancedThreatProtectionSettingInner advancedThreatProtectionSetting, Context context) { + return createWithResponseAsync(resourceId, advancedThreatProtectionSetting, context).block(); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AdvancedThreatProtectionsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AdvancedThreatProtectionsImpl.java new file mode 100644 index 000000000000..efc44107675a --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AdvancedThreatProtectionsImpl.java @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.AdvancedThreatProtectionsClient; +import com.azure.resourcemanager.security.fluent.models.AdvancedThreatProtectionSettingInner; +import com.azure.resourcemanager.security.models.AdvancedThreatProtectionSetting; +import com.azure.resourcemanager.security.models.AdvancedThreatProtections; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class AdvancedThreatProtectionsImpl implements AdvancedThreatProtections { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AdvancedThreatProtectionsImpl.class); + + private final AdvancedThreatProtectionsClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public AdvancedThreatProtectionsImpl( + AdvancedThreatProtectionsClient innerClient, + com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public AdvancedThreatProtectionSetting get(String resourceId) { + AdvancedThreatProtectionSettingInner inner = this.serviceClient().get(resourceId); + if (inner != null) { + return new AdvancedThreatProtectionSettingImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse(String resourceId, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceId, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new AdvancedThreatProtectionSettingImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public AdvancedThreatProtectionSetting getById(String id) { + String resourceId = + Utils + .getValueFromIdByParameterName( + id, + "/{resourceId}/providers/Microsoft.Security/advancedThreatProtectionSettings/{settingName}", + "resourceId"); + if (resourceId == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceId'.", id))); + } + return this.getWithResponse(resourceId, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceId = + Utils + .getValueFromIdByParameterName( + id, + "/{resourceId}/providers/Microsoft.Security/advancedThreatProtectionSettings/{settingName}", + "resourceId"); + if (resourceId == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceId'.", id))); + } + return this.getWithResponse(resourceId, context); + } + + private AdvancedThreatProtectionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } + + public AdvancedThreatProtectionSettingImpl define() { + return new AdvancedThreatProtectionSettingImpl(this.manager()); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AlertImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AlertImpl.java new file mode 100644 index 000000000000..d2ed1dc1adb3 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AlertImpl.java @@ -0,0 +1,165 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.resourcemanager.security.fluent.models.AlertInner; +import com.azure.resourcemanager.security.models.Alert; +import com.azure.resourcemanager.security.models.AlertEntity; +import com.azure.resourcemanager.security.models.AlertSeverity; +import com.azure.resourcemanager.security.models.AlertStatus; +import com.azure.resourcemanager.security.models.Intent; +import com.azure.resourcemanager.security.models.ResourceIdentifier; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public final class AlertImpl implements Alert { + private AlertInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + AlertImpl(AlertInner innerObject, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String alertType() { + return this.innerModel().alertType(); + } + + public String systemAlertId() { + return this.innerModel().systemAlertId(); + } + + public String productComponentName() { + return this.innerModel().productComponentName(); + } + + public String alertDisplayName() { + return this.innerModel().alertDisplayName(); + } + + public String description() { + return this.innerModel().description(); + } + + public AlertSeverity severity() { + return this.innerModel().severity(); + } + + public Intent intent() { + return this.innerModel().intent(); + } + + public OffsetDateTime startTimeUtc() { + return this.innerModel().startTimeUtc(); + } + + public OffsetDateTime endTimeUtc() { + return this.innerModel().endTimeUtc(); + } + + public List resourceIdentifiers() { + List inner = this.innerModel().resourceIdentifiers(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List remediationSteps() { + List inner = this.innerModel().remediationSteps(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public String vendorName() { + return this.innerModel().vendorName(); + } + + public AlertStatus status() { + return this.innerModel().status(); + } + + public List> extendedLinks() { + List> inner = this.innerModel().extendedLinks(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public String alertUri() { + return this.innerModel().alertUri(); + } + + public OffsetDateTime timeGeneratedUtc() { + return this.innerModel().timeGeneratedUtc(); + } + + public String productName() { + return this.innerModel().productName(); + } + + public OffsetDateTime processingEndTimeUtc() { + return this.innerModel().processingEndTimeUtc(); + } + + public List entities() { + List inner = this.innerModel().entities(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public Boolean isIncident() { + return this.innerModel().isIncident(); + } + + public String correlationKey() { + return this.innerModel().correlationKey(); + } + + public Map extendedProperties() { + Map inner = this.innerModel().extendedProperties(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public String compromisedEntity() { + return this.innerModel().compromisedEntity(); + } + + public AlertInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AlertsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AlertsClientImpl.java new file mode 100644 index 000000000000..3739ecb90aa4 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AlertsClientImpl.java @@ -0,0 +1,2775 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.security.fluent.AlertsClient; +import com.azure.resourcemanager.security.fluent.models.AlertInner; +import com.azure.resourcemanager.security.models.AlertList; +import com.azure.resourcemanager.security.models.AlertSimulatorRequestBody; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in AlertsClient. */ +public final class AlertsClientImpl implements AlertsClient { + private final ClientLogger logger = new ClientLogger(AlertsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final AlertsService service; + + /** The service client containing this operation class. */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of AlertsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + AlertsClientImpl(SecurityCenterImpl client) { + this.service = RestProxy.create(AlertsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterAlerts to be used by the proxy service to perform REST + * calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityCenterAlerts") + private interface AlertsService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/alerts") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/alerts") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listSubscriptionLevelByRegion( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("ascLocation") String ascLocation, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations" + + "/{ascLocation}/alerts") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listResourceGroupLevelByRegion( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("ascLocation") String ascLocation, + @PathParam("resourceGroupName") String resourceGroupName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getSubscriptionLevel( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("ascLocation") String ascLocation, + @PathParam("alertName") String alertName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations" + + "/{ascLocation}/alerts/{alertName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getResourceGroupLevel( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("ascLocation") String ascLocation, + @PathParam("alertName") String alertName, + @PathParam("resourceGroupName") String resourceGroupName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}" + + "/dismiss") + @ExpectedResponses({204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> updateSubscriptionLevelStateToDismiss( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("ascLocation") String ascLocation, + @PathParam("alertName") String alertName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}" + + "/resolve") + @ExpectedResponses({204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> updateSubscriptionLevelStateToResolve( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("ascLocation") String ascLocation, + @PathParam("alertName") String alertName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}" + + "/activate") + @ExpectedResponses({204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> updateSubscriptionLevelStateToActivate( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("ascLocation") String ascLocation, + @PathParam("alertName") String alertName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations" + + "/{ascLocation}/alerts/{alertName}/resolve") + @ExpectedResponses({204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> updateResourceGroupLevelStateToResolve( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("ascLocation") String ascLocation, + @PathParam("alertName") String alertName, + @PathParam("resourceGroupName") String resourceGroupName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations" + + "/{ascLocation}/alerts/{alertName}/dismiss") + @ExpectedResponses({204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> updateResourceGroupLevelStateToDismiss( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("ascLocation") String ascLocation, + @PathParam("alertName") String alertName, + @PathParam("resourceGroupName") String resourceGroupName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations" + + "/{ascLocation}/alerts/{alertName}/activate") + @ExpectedResponses({204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> updateResourceGroupLevelStateToActivate( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("ascLocation") String ascLocation, + @PathParam("alertName") String alertName, + @PathParam("resourceGroupName") String resourceGroupName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/default" + + "/simulate") + @ExpectedResponses({202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> simulate( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("ascLocation") String ascLocation, + @BodyParam("application/json") AlertSimulatorRequestBody alertSimulatorRequestBody, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listSubscriptionLevelByRegionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listResourceGroupLevelByRegionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List all the alerts that are associated with the subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security alerts. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-01-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List all the alerts that are associated with the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security alerts. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-01-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List all the alerts that are associated with the subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security alerts. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List all the alerts that are associated with the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security alerts. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List all the alerts that are associated with the subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security alerts. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * List all the alerts that are associated with the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security alerts. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * List all the alerts that are associated with the resource group. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security alerts. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String apiVersion = "2021-01-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List all the alerts that are associated with the resource group. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security alerts. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String apiVersion = "2021-01-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List all the alerts that are associated with the resource group. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security alerts. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * List all the alerts that are associated with the resource group. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security alerts. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * List all the alerts that are associated with the resource group. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security alerts. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * List all the alerts that are associated with the resource group. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security alerts. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * List all the alerts that are associated with the subscription that are stored in a specific location. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security alerts. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSubscriptionLevelByRegionSinglePageAsync(String ascLocation) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (ascLocation == null) { + return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + final String apiVersion = "2021-01-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listSubscriptionLevelByRegion( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + ascLocation, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List all the alerts that are associated with the subscription that are stored in a specific location. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security alerts. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSubscriptionLevelByRegionSinglePageAsync( + String ascLocation, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (ascLocation == null) { + return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + final String apiVersion = "2021-01-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listSubscriptionLevelByRegion( + this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), ascLocation, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List all the alerts that are associated with the subscription that are stored in a specific location. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security alerts. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listSubscriptionLevelByRegionAsync(String ascLocation) { + return new PagedFlux<>( + () -> listSubscriptionLevelByRegionSinglePageAsync(ascLocation), + nextLink -> listSubscriptionLevelByRegionNextSinglePageAsync(nextLink)); + } + + /** + * List all the alerts that are associated with the subscription that are stored in a specific location. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security alerts. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listSubscriptionLevelByRegionAsync(String ascLocation, Context context) { + return new PagedFlux<>( + () -> listSubscriptionLevelByRegionSinglePageAsync(ascLocation, context), + nextLink -> listSubscriptionLevelByRegionNextSinglePageAsync(nextLink, context)); + } + + /** + * List all the alerts that are associated with the subscription that are stored in a specific location. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security alerts. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listSubscriptionLevelByRegion(String ascLocation) { + return new PagedIterable<>(listSubscriptionLevelByRegionAsync(ascLocation)); + } + + /** + * List all the alerts that are associated with the subscription that are stored in a specific location. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security alerts. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listSubscriptionLevelByRegion(String ascLocation, Context context) { + return new PagedIterable<>(listSubscriptionLevelByRegionAsync(ascLocation, context)); + } + + /** + * List all the alerts that are associated with the resource group that are stored in a specific location. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security alerts. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listResourceGroupLevelByRegionSinglePageAsync( + String ascLocation, String resourceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (ascLocation == null) { + return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String apiVersion = "2021-01-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listResourceGroupLevelByRegion( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + ascLocation, + resourceGroupName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List all the alerts that are associated with the resource group that are stored in a specific location. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security alerts. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listResourceGroupLevelByRegionSinglePageAsync( + String ascLocation, String resourceGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (ascLocation == null) { + return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String apiVersion = "2021-01-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listResourceGroupLevelByRegion( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + ascLocation, + resourceGroupName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List all the alerts that are associated with the resource group that are stored in a specific location. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security alerts. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listResourceGroupLevelByRegionAsync(String ascLocation, String resourceGroupName) { + return new PagedFlux<>( + () -> listResourceGroupLevelByRegionSinglePageAsync(ascLocation, resourceGroupName), + nextLink -> listResourceGroupLevelByRegionNextSinglePageAsync(nextLink)); + } + + /** + * List all the alerts that are associated with the resource group that are stored in a specific location. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security alerts. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listResourceGroupLevelByRegionAsync( + String ascLocation, String resourceGroupName, Context context) { + return new PagedFlux<>( + () -> listResourceGroupLevelByRegionSinglePageAsync(ascLocation, resourceGroupName, context), + nextLink -> listResourceGroupLevelByRegionNextSinglePageAsync(nextLink, context)); + } + + /** + * List all the alerts that are associated with the resource group that are stored in a specific location. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security alerts. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listResourceGroupLevelByRegion(String ascLocation, String resourceGroupName) { + return new PagedIterable<>(listResourceGroupLevelByRegionAsync(ascLocation, resourceGroupName)); + } + + /** + * List all the alerts that are associated with the resource group that are stored in a specific location. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security alerts. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listResourceGroupLevelByRegion( + String ascLocation, String resourceGroupName, Context context) { + return new PagedIterable<>(listResourceGroupLevelByRegionAsync(ascLocation, resourceGroupName, context)); + } + + /** + * Get an alert that is associated with a subscription. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param alertName Name of the alert object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an alert that is associated with a subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getSubscriptionLevelWithResponseAsync(String ascLocation, String alertName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (ascLocation == null) { + return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + if (alertName == null) { + return Mono.error(new IllegalArgumentException("Parameter alertName is required and cannot be null.")); + } + final String apiVersion = "2021-01-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getSubscriptionLevel( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + ascLocation, + alertName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get an alert that is associated with a subscription. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param alertName Name of the alert object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an alert that is associated with a subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getSubscriptionLevelWithResponseAsync( + String ascLocation, String alertName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (ascLocation == null) { + return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + if (alertName == null) { + return Mono.error(new IllegalArgumentException("Parameter alertName is required and cannot be null.")); + } + final String apiVersion = "2021-01-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getSubscriptionLevel( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + ascLocation, + alertName, + accept, + context); + } + + /** + * Get an alert that is associated with a subscription. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param alertName Name of the alert object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an alert that is associated with a subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getSubscriptionLevelAsync(String ascLocation, String alertName) { + return getSubscriptionLevelWithResponseAsync(ascLocation, alertName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get an alert that is associated with a subscription. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param alertName Name of the alert object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an alert that is associated with a subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AlertInner getSubscriptionLevel(String ascLocation, String alertName) { + return getSubscriptionLevelAsync(ascLocation, alertName).block(); + } + + /** + * Get an alert that is associated with a subscription. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param alertName Name of the alert object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an alert that is associated with a subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getSubscriptionLevelWithResponse( + String ascLocation, String alertName, Context context) { + return getSubscriptionLevelWithResponseAsync(ascLocation, alertName, context).block(); + } + + /** + * Get an alert that is associated a resource group or a resource in a resource group. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param alertName Name of the alert object. + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an alert that is associated a resource group or a resource in a resource group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getResourceGroupLevelWithResponseAsync( + String ascLocation, String alertName, String resourceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (ascLocation == null) { + return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + if (alertName == null) { + return Mono.error(new IllegalArgumentException("Parameter alertName is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String apiVersion = "2021-01-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getResourceGroupLevel( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + ascLocation, + alertName, + resourceGroupName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get an alert that is associated a resource group or a resource in a resource group. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param alertName Name of the alert object. + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an alert that is associated a resource group or a resource in a resource group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getResourceGroupLevelWithResponseAsync( + String ascLocation, String alertName, String resourceGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (ascLocation == null) { + return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + if (alertName == null) { + return Mono.error(new IllegalArgumentException("Parameter alertName is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String apiVersion = "2021-01-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getResourceGroupLevel( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + ascLocation, + alertName, + resourceGroupName, + accept, + context); + } + + /** + * Get an alert that is associated a resource group or a resource in a resource group. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param alertName Name of the alert object. + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an alert that is associated a resource group or a resource in a resource group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getResourceGroupLevelAsync( + String ascLocation, String alertName, String resourceGroupName) { + return getResourceGroupLevelWithResponseAsync(ascLocation, alertName, resourceGroupName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get an alert that is associated a resource group or a resource in a resource group. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param alertName Name of the alert object. + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an alert that is associated a resource group or a resource in a resource group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AlertInner getResourceGroupLevel(String ascLocation, String alertName, String resourceGroupName) { + return getResourceGroupLevelAsync(ascLocation, alertName, resourceGroupName).block(); + } + + /** + * Get an alert that is associated a resource group or a resource in a resource group. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param alertName Name of the alert object. + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an alert that is associated a resource group or a resource in a resource group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getResourceGroupLevelWithResponse( + String ascLocation, String alertName, String resourceGroupName, Context context) { + return getResourceGroupLevelWithResponseAsync(ascLocation, alertName, resourceGroupName, context).block(); + } + + /** + * Update the alert's state. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param alertName Name of the alert object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateSubscriptionLevelStateToDismissWithResponseAsync( + String ascLocation, String alertName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (ascLocation == null) { + return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + if (alertName == null) { + return Mono.error(new IllegalArgumentException("Parameter alertName is required and cannot be null.")); + } + final String apiVersion = "2021-01-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .updateSubscriptionLevelStateToDismiss( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + ascLocation, + alertName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update the alert's state. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param alertName Name of the alert object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateSubscriptionLevelStateToDismissWithResponseAsync( + String ascLocation, String alertName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (ascLocation == null) { + return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + if (alertName == null) { + return Mono.error(new IllegalArgumentException("Parameter alertName is required and cannot be null.")); + } + final String apiVersion = "2021-01-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .updateSubscriptionLevelStateToDismiss( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + ascLocation, + alertName, + accept, + context); + } + + /** + * Update the alert's state. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param alertName Name of the alert object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateSubscriptionLevelStateToDismissAsync(String ascLocation, String alertName) { + return updateSubscriptionLevelStateToDismissWithResponseAsync(ascLocation, alertName) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Update the alert's state. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param alertName Name of the alert object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void updateSubscriptionLevelStateToDismiss(String ascLocation, String alertName) { + updateSubscriptionLevelStateToDismissAsync(ascLocation, alertName).block(); + } + + /** + * Update the alert's state. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param alertName Name of the alert object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateSubscriptionLevelStateToDismissWithResponse( + String ascLocation, String alertName, Context context) { + return updateSubscriptionLevelStateToDismissWithResponseAsync(ascLocation, alertName, context).block(); + } + + /** + * Update the alert's state. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param alertName Name of the alert object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateSubscriptionLevelStateToResolveWithResponseAsync( + String ascLocation, String alertName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (ascLocation == null) { + return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + if (alertName == null) { + return Mono.error(new IllegalArgumentException("Parameter alertName is required and cannot be null.")); + } + final String apiVersion = "2021-01-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .updateSubscriptionLevelStateToResolve( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + ascLocation, + alertName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update the alert's state. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param alertName Name of the alert object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateSubscriptionLevelStateToResolveWithResponseAsync( + String ascLocation, String alertName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (ascLocation == null) { + return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + if (alertName == null) { + return Mono.error(new IllegalArgumentException("Parameter alertName is required and cannot be null.")); + } + final String apiVersion = "2021-01-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .updateSubscriptionLevelStateToResolve( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + ascLocation, + alertName, + accept, + context); + } + + /** + * Update the alert's state. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param alertName Name of the alert object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateSubscriptionLevelStateToResolveAsync(String ascLocation, String alertName) { + return updateSubscriptionLevelStateToResolveWithResponseAsync(ascLocation, alertName) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Update the alert's state. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param alertName Name of the alert object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void updateSubscriptionLevelStateToResolve(String ascLocation, String alertName) { + updateSubscriptionLevelStateToResolveAsync(ascLocation, alertName).block(); + } + + /** + * Update the alert's state. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param alertName Name of the alert object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateSubscriptionLevelStateToResolveWithResponse( + String ascLocation, String alertName, Context context) { + return updateSubscriptionLevelStateToResolveWithResponseAsync(ascLocation, alertName, context).block(); + } + + /** + * Update the alert's state. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param alertName Name of the alert object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateSubscriptionLevelStateToActivateWithResponseAsync( + String ascLocation, String alertName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (ascLocation == null) { + return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + if (alertName == null) { + return Mono.error(new IllegalArgumentException("Parameter alertName is required and cannot be null.")); + } + final String apiVersion = "2021-01-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .updateSubscriptionLevelStateToActivate( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + ascLocation, + alertName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update the alert's state. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param alertName Name of the alert object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateSubscriptionLevelStateToActivateWithResponseAsync( + String ascLocation, String alertName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (ascLocation == null) { + return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + if (alertName == null) { + return Mono.error(new IllegalArgumentException("Parameter alertName is required and cannot be null.")); + } + final String apiVersion = "2021-01-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .updateSubscriptionLevelStateToActivate( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + ascLocation, + alertName, + accept, + context); + } + + /** + * Update the alert's state. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param alertName Name of the alert object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateSubscriptionLevelStateToActivateAsync(String ascLocation, String alertName) { + return updateSubscriptionLevelStateToActivateWithResponseAsync(ascLocation, alertName) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Update the alert's state. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param alertName Name of the alert object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void updateSubscriptionLevelStateToActivate(String ascLocation, String alertName) { + updateSubscriptionLevelStateToActivateAsync(ascLocation, alertName).block(); + } + + /** + * Update the alert's state. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param alertName Name of the alert object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateSubscriptionLevelStateToActivateWithResponse( + String ascLocation, String alertName, Context context) { + return updateSubscriptionLevelStateToActivateWithResponseAsync(ascLocation, alertName, context).block(); + } + + /** + * Update the alert's state. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param alertName Name of the alert object. + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateResourceGroupLevelStateToResolveWithResponseAsync( + String ascLocation, String alertName, String resourceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (ascLocation == null) { + return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + if (alertName == null) { + return Mono.error(new IllegalArgumentException("Parameter alertName is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String apiVersion = "2021-01-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .updateResourceGroupLevelStateToResolve( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + ascLocation, + alertName, + resourceGroupName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update the alert's state. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param alertName Name of the alert object. + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateResourceGroupLevelStateToResolveWithResponseAsync( + String ascLocation, String alertName, String resourceGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (ascLocation == null) { + return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + if (alertName == null) { + return Mono.error(new IllegalArgumentException("Parameter alertName is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String apiVersion = "2021-01-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .updateResourceGroupLevelStateToResolve( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + ascLocation, + alertName, + resourceGroupName, + accept, + context); + } + + /** + * Update the alert's state. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param alertName Name of the alert object. + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateResourceGroupLevelStateToResolveAsync( + String ascLocation, String alertName, String resourceGroupName) { + return updateResourceGroupLevelStateToResolveWithResponseAsync(ascLocation, alertName, resourceGroupName) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Update the alert's state. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param alertName Name of the alert object. + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void updateResourceGroupLevelStateToResolve(String ascLocation, String alertName, String resourceGroupName) { + updateResourceGroupLevelStateToResolveAsync(ascLocation, alertName, resourceGroupName).block(); + } + + /** + * Update the alert's state. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param alertName Name of the alert object. + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateResourceGroupLevelStateToResolveWithResponse( + String ascLocation, String alertName, String resourceGroupName, Context context) { + return updateResourceGroupLevelStateToResolveWithResponseAsync( + ascLocation, alertName, resourceGroupName, context) + .block(); + } + + /** + * Update the alert's state. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param alertName Name of the alert object. + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateResourceGroupLevelStateToDismissWithResponseAsync( + String ascLocation, String alertName, String resourceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (ascLocation == null) { + return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + if (alertName == null) { + return Mono.error(new IllegalArgumentException("Parameter alertName is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String apiVersion = "2021-01-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .updateResourceGroupLevelStateToDismiss( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + ascLocation, + alertName, + resourceGroupName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update the alert's state. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param alertName Name of the alert object. + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateResourceGroupLevelStateToDismissWithResponseAsync( + String ascLocation, String alertName, String resourceGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (ascLocation == null) { + return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + if (alertName == null) { + return Mono.error(new IllegalArgumentException("Parameter alertName is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String apiVersion = "2021-01-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .updateResourceGroupLevelStateToDismiss( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + ascLocation, + alertName, + resourceGroupName, + accept, + context); + } + + /** + * Update the alert's state. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param alertName Name of the alert object. + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateResourceGroupLevelStateToDismissAsync( + String ascLocation, String alertName, String resourceGroupName) { + return updateResourceGroupLevelStateToDismissWithResponseAsync(ascLocation, alertName, resourceGroupName) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Update the alert's state. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param alertName Name of the alert object. + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void updateResourceGroupLevelStateToDismiss(String ascLocation, String alertName, String resourceGroupName) { + updateResourceGroupLevelStateToDismissAsync(ascLocation, alertName, resourceGroupName).block(); + } + + /** + * Update the alert's state. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param alertName Name of the alert object. + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateResourceGroupLevelStateToDismissWithResponse( + String ascLocation, String alertName, String resourceGroupName, Context context) { + return updateResourceGroupLevelStateToDismissWithResponseAsync( + ascLocation, alertName, resourceGroupName, context) + .block(); + } + + /** + * Update the alert's state. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param alertName Name of the alert object. + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateResourceGroupLevelStateToActivateWithResponseAsync( + String ascLocation, String alertName, String resourceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (ascLocation == null) { + return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + if (alertName == null) { + return Mono.error(new IllegalArgumentException("Parameter alertName is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String apiVersion = "2021-01-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .updateResourceGroupLevelStateToActivate( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + ascLocation, + alertName, + resourceGroupName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update the alert's state. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param alertName Name of the alert object. + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateResourceGroupLevelStateToActivateWithResponseAsync( + String ascLocation, String alertName, String resourceGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (ascLocation == null) { + return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + if (alertName == null) { + return Mono.error(new IllegalArgumentException("Parameter alertName is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String apiVersion = "2021-01-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .updateResourceGroupLevelStateToActivate( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + ascLocation, + alertName, + resourceGroupName, + accept, + context); + } + + /** + * Update the alert's state. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param alertName Name of the alert object. + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateResourceGroupLevelStateToActivateAsync( + String ascLocation, String alertName, String resourceGroupName) { + return updateResourceGroupLevelStateToActivateWithResponseAsync(ascLocation, alertName, resourceGroupName) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Update the alert's state. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param alertName Name of the alert object. + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void updateResourceGroupLevelStateToActivate( + String ascLocation, String alertName, String resourceGroupName) { + updateResourceGroupLevelStateToActivateAsync(ascLocation, alertName, resourceGroupName).block(); + } + + /** + * Update the alert's state. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param alertName Name of the alert object. + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateResourceGroupLevelStateToActivateWithResponse( + String ascLocation, String alertName, String resourceGroupName, Context context) { + return updateResourceGroupLevelStateToActivateWithResponseAsync( + ascLocation, alertName, resourceGroupName, context) + .block(); + } + + /** + * Simulate security alerts. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param alertSimulatorRequestBody Alert Simulator Request Properties. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> simulateWithResponseAsync( + String ascLocation, AlertSimulatorRequestBody alertSimulatorRequestBody) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (ascLocation == null) { + return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + if (alertSimulatorRequestBody == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter alertSimulatorRequestBody is required and cannot be null.")); + } else { + alertSimulatorRequestBody.validate(); + } + final String apiVersion = "2021-01-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .simulate( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + ascLocation, + alertSimulatorRequestBody, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Simulate security alerts. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param alertSimulatorRequestBody Alert Simulator Request Properties. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> simulateWithResponseAsync( + String ascLocation, AlertSimulatorRequestBody alertSimulatorRequestBody, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (ascLocation == null) { + return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + if (alertSimulatorRequestBody == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter alertSimulatorRequestBody is required and cannot be null.")); + } else { + alertSimulatorRequestBody.validate(); + } + final String apiVersion = "2021-01-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .simulate( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + ascLocation, + alertSimulatorRequestBody, + accept, + context); + } + + /** + * Simulate security alerts. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param alertSimulatorRequestBody Alert Simulator Request Properties. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginSimulateAsync( + String ascLocation, AlertSimulatorRequestBody alertSimulatorRequestBody) { + Mono>> mono = simulateWithResponseAsync(ascLocation, alertSimulatorRequestBody); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Simulate security alerts. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param alertSimulatorRequestBody Alert Simulator Request Properties. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginSimulateAsync( + String ascLocation, AlertSimulatorRequestBody alertSimulatorRequestBody, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + simulateWithResponseAsync(ascLocation, alertSimulatorRequestBody, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Simulate security alerts. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param alertSimulatorRequestBody Alert Simulator Request Properties. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginSimulate( + String ascLocation, AlertSimulatorRequestBody alertSimulatorRequestBody) { + return beginSimulateAsync(ascLocation, alertSimulatorRequestBody).getSyncPoller(); + } + + /** + * Simulate security alerts. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param alertSimulatorRequestBody Alert Simulator Request Properties. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginSimulate( + String ascLocation, AlertSimulatorRequestBody alertSimulatorRequestBody, Context context) { + return beginSimulateAsync(ascLocation, alertSimulatorRequestBody, context).getSyncPoller(); + } + + /** + * Simulate security alerts. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param alertSimulatorRequestBody Alert Simulator Request Properties. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono simulateAsync(String ascLocation, AlertSimulatorRequestBody alertSimulatorRequestBody) { + return beginSimulateAsync(ascLocation, alertSimulatorRequestBody) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Simulate security alerts. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param alertSimulatorRequestBody Alert Simulator Request Properties. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono simulateAsync( + String ascLocation, AlertSimulatorRequestBody alertSimulatorRequestBody, Context context) { + return beginSimulateAsync(ascLocation, alertSimulatorRequestBody, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Simulate security alerts. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param alertSimulatorRequestBody Alert Simulator Request Properties. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void simulate(String ascLocation, AlertSimulatorRequestBody alertSimulatorRequestBody) { + simulateAsync(ascLocation, alertSimulatorRequestBody).block(); + } + + /** + * Simulate security alerts. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param alertSimulatorRequestBody Alert Simulator Request Properties. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void simulate(String ascLocation, AlertSimulatorRequestBody alertSimulatorRequestBody, Context context) { + simulateAsync(ascLocation, alertSimulatorRequestBody, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security alerts. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security alerts. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security alerts. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security alerts. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security alerts. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSubscriptionLevelByRegionNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service.listSubscriptionLevelByRegionNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security alerts. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSubscriptionLevelByRegionNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listSubscriptionLevelByRegionNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security alerts. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listResourceGroupLevelByRegionNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service.listResourceGroupLevelByRegionNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security alerts. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listResourceGroupLevelByRegionNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listResourceGroupLevelByRegionNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AlertsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AlertsImpl.java new file mode 100644 index 000000000000..cbb8469c73ee --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AlertsImpl.java @@ -0,0 +1,197 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.AlertsClient; +import com.azure.resourcemanager.security.fluent.models.AlertInner; +import com.azure.resourcemanager.security.models.Alert; +import com.azure.resourcemanager.security.models.AlertSimulatorRequestBody; +import com.azure.resourcemanager.security.models.Alerts; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class AlertsImpl implements Alerts { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AlertsImpl.class); + + private final AlertsClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public AlertsImpl(AlertsClient innerClient, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new AlertImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new AlertImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new AlertImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new AlertImpl(inner1, this.manager())); + } + + public PagedIterable listSubscriptionLevelByRegion(String ascLocation) { + PagedIterable inner = this.serviceClient().listSubscriptionLevelByRegion(ascLocation); + return Utils.mapPage(inner, inner1 -> new AlertImpl(inner1, this.manager())); + } + + public PagedIterable listSubscriptionLevelByRegion(String ascLocation, Context context) { + PagedIterable inner = this.serviceClient().listSubscriptionLevelByRegion(ascLocation, context); + return Utils.mapPage(inner, inner1 -> new AlertImpl(inner1, this.manager())); + } + + public PagedIterable listResourceGroupLevelByRegion(String ascLocation, String resourceGroupName) { + PagedIterable inner = + this.serviceClient().listResourceGroupLevelByRegion(ascLocation, resourceGroupName); + return Utils.mapPage(inner, inner1 -> new AlertImpl(inner1, this.manager())); + } + + public PagedIterable listResourceGroupLevelByRegion( + String ascLocation, String resourceGroupName, Context context) { + PagedIterable inner = + this.serviceClient().listResourceGroupLevelByRegion(ascLocation, resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new AlertImpl(inner1, this.manager())); + } + + public Alert getSubscriptionLevel(String ascLocation, String alertName) { + AlertInner inner = this.serviceClient().getSubscriptionLevel(ascLocation, alertName); + if (inner != null) { + return new AlertImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getSubscriptionLevelWithResponse(String ascLocation, String alertName, Context context) { + Response inner = + this.serviceClient().getSubscriptionLevelWithResponse(ascLocation, alertName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new AlertImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Alert getResourceGroupLevel(String ascLocation, String alertName, String resourceGroupName) { + AlertInner inner = this.serviceClient().getResourceGroupLevel(ascLocation, alertName, resourceGroupName); + if (inner != null) { + return new AlertImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getResourceGroupLevelWithResponse( + String ascLocation, String alertName, String resourceGroupName, Context context) { + Response inner = + this.serviceClient().getResourceGroupLevelWithResponse(ascLocation, alertName, resourceGroupName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new AlertImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void updateSubscriptionLevelStateToDismiss(String ascLocation, String alertName) { + this.serviceClient().updateSubscriptionLevelStateToDismiss(ascLocation, alertName); + } + + public Response updateSubscriptionLevelStateToDismissWithResponse( + String ascLocation, String alertName, Context context) { + return this.serviceClient().updateSubscriptionLevelStateToDismissWithResponse(ascLocation, alertName, context); + } + + public void updateSubscriptionLevelStateToResolve(String ascLocation, String alertName) { + this.serviceClient().updateSubscriptionLevelStateToResolve(ascLocation, alertName); + } + + public Response updateSubscriptionLevelStateToResolveWithResponse( + String ascLocation, String alertName, Context context) { + return this.serviceClient().updateSubscriptionLevelStateToResolveWithResponse(ascLocation, alertName, context); + } + + public void updateSubscriptionLevelStateToActivate(String ascLocation, String alertName) { + this.serviceClient().updateSubscriptionLevelStateToActivate(ascLocation, alertName); + } + + public Response updateSubscriptionLevelStateToActivateWithResponse( + String ascLocation, String alertName, Context context) { + return this.serviceClient().updateSubscriptionLevelStateToActivateWithResponse(ascLocation, alertName, context); + } + + public void updateResourceGroupLevelStateToResolve(String ascLocation, String alertName, String resourceGroupName) { + this.serviceClient().updateResourceGroupLevelStateToResolve(ascLocation, alertName, resourceGroupName); + } + + public Response updateResourceGroupLevelStateToResolveWithResponse( + String ascLocation, String alertName, String resourceGroupName, Context context) { + return this + .serviceClient() + .updateResourceGroupLevelStateToResolveWithResponse(ascLocation, alertName, resourceGroupName, context); + } + + public void updateResourceGroupLevelStateToDismiss(String ascLocation, String alertName, String resourceGroupName) { + this.serviceClient().updateResourceGroupLevelStateToDismiss(ascLocation, alertName, resourceGroupName); + } + + public Response updateResourceGroupLevelStateToDismissWithResponse( + String ascLocation, String alertName, String resourceGroupName, Context context) { + return this + .serviceClient() + .updateResourceGroupLevelStateToDismissWithResponse(ascLocation, alertName, resourceGroupName, context); + } + + public void updateResourceGroupLevelStateToActivate( + String ascLocation, String alertName, String resourceGroupName) { + this.serviceClient().updateResourceGroupLevelStateToActivate(ascLocation, alertName, resourceGroupName); + } + + public Response updateResourceGroupLevelStateToActivateWithResponse( + String ascLocation, String alertName, String resourceGroupName, Context context) { + return this + .serviceClient() + .updateResourceGroupLevelStateToActivateWithResponse(ascLocation, alertName, resourceGroupName, context); + } + + public void simulate(String ascLocation, AlertSimulatorRequestBody alertSimulatorRequestBody) { + this.serviceClient().simulate(ascLocation, alertSimulatorRequestBody); + } + + public void simulate(String ascLocation, AlertSimulatorRequestBody alertSimulatorRequestBody, Context context) { + this.serviceClient().simulate(ascLocation, alertSimulatorRequestBody, context); + } + + private AlertsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AlertsSuppressionRuleImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AlertsSuppressionRuleImpl.java new file mode 100644 index 000000000000..dba39316deae --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AlertsSuppressionRuleImpl.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.resourcemanager.security.fluent.models.AlertsSuppressionRuleInner; +import com.azure.resourcemanager.security.models.AlertsSuppressionRule; +import com.azure.resourcemanager.security.models.RuleState; +import com.azure.resourcemanager.security.models.SuppressionAlertsScope; +import java.time.OffsetDateTime; + +public final class AlertsSuppressionRuleImpl implements AlertsSuppressionRule { + private AlertsSuppressionRuleInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + AlertsSuppressionRuleImpl( + AlertsSuppressionRuleInner innerObject, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String alertType() { + return this.innerModel().alertType(); + } + + public OffsetDateTime lastModifiedUtc() { + return this.innerModel().lastModifiedUtc(); + } + + public OffsetDateTime expirationDateUtc() { + return this.innerModel().expirationDateUtc(); + } + + public String reason() { + return this.innerModel().reason(); + } + + public RuleState state() { + return this.innerModel().state(); + } + + public String comment() { + return this.innerModel().comment(); + } + + public SuppressionAlertsScope suppressionAlertsScope() { + return this.innerModel().suppressionAlertsScope(); + } + + public AlertsSuppressionRuleInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AlertsSuppressionRulesClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AlertsSuppressionRulesClientImpl.java new file mode 100644 index 000000000000..8219644bdd9e --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AlertsSuppressionRulesClientImpl.java @@ -0,0 +1,794 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.AlertsSuppressionRulesClient; +import com.azure.resourcemanager.security.fluent.models.AlertsSuppressionRuleInner; +import com.azure.resourcemanager.security.models.AlertsSuppressionRulesList; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in AlertsSuppressionRulesClient. */ +public final class AlertsSuppressionRulesClientImpl implements AlertsSuppressionRulesClient { + private final ClientLogger logger = new ClientLogger(AlertsSuppressionRulesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final AlertsSuppressionRulesService service; + + /** The service client containing this operation class. */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of AlertsSuppressionRulesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + AlertsSuppressionRulesClientImpl(SecurityCenterImpl client) { + this.service = + RestProxy + .create(AlertsSuppressionRulesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterAlertsSuppressionRules to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityCenterAlerts") + private interface AlertsSuppressionRulesService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/alertsSuppressionRules") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("AlertType") String alertType, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/providers/Microsoft.Security/alertsSuppressionRules" + + "/{alertsSuppressionRuleName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("alertsSuppressionRuleName") String alertsSuppressionRuleName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/providers/Microsoft.Security/alertsSuppressionRules" + + "/{alertsSuppressionRuleName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("alertsSuppressionRuleName") String alertsSuppressionRuleName, + @BodyParam("application/json") AlertsSuppressionRuleInner alertsSuppressionRule, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/providers/Microsoft.Security/alertsSuppressionRules" + + "/{alertsSuppressionRuleName}") + @ExpectedResponses({204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("alertsSuppressionRuleName") String alertsSuppressionRuleName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List of all the dismiss rules for the given subscription. + * + * @param alertType Type of the alert to get rules for. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return suppression rules list for subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String alertType) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2019-01-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + alertType, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List of all the dismiss rules for the given subscription. + * + * @param alertType Type of the alert to get rules for. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return suppression rules list for subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String alertType, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2019-01-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), alertType, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List of all the dismiss rules for the given subscription. + * + * @param alertType Type of the alert to get rules for. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return suppression rules list for subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String alertType) { + return new PagedFlux<>(() -> listSinglePageAsync(alertType), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List of all the dismiss rules for the given subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return suppression rules list for subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + final String alertType = null; + return new PagedFlux<>(() -> listSinglePageAsync(alertType), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List of all the dismiss rules for the given subscription. + * + * @param alertType Type of the alert to get rules for. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return suppression rules list for subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String alertType, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(alertType, context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List of all the dismiss rules for the given subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return suppression rules list for subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + final String alertType = null; + return new PagedIterable<>(listAsync(alertType)); + } + + /** + * List of all the dismiss rules for the given subscription. + * + * @param alertType Type of the alert to get rules for. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return suppression rules list for subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String alertType, Context context) { + return new PagedIterable<>(listAsync(alertType, context)); + } + + /** + * Get dismiss rule, with name: {alertsSuppressionRuleName}, for the given subscription. + * + * @param alertsSuppressionRuleName The unique name of the suppression alert rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return dismiss rule, with name: {alertsSuppressionRuleName}, for the given subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String alertsSuppressionRuleName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (alertsSuppressionRuleName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter alertsSuppressionRuleName is required and cannot be null.")); + } + final String apiVersion = "2019-01-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + alertsSuppressionRuleName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get dismiss rule, with name: {alertsSuppressionRuleName}, for the given subscription. + * + * @param alertsSuppressionRuleName The unique name of the suppression alert rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return dismiss rule, with name: {alertsSuppressionRuleName}, for the given subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String alertsSuppressionRuleName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (alertsSuppressionRuleName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter alertsSuppressionRuleName is required and cannot be null.")); + } + final String apiVersion = "2019-01-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + alertsSuppressionRuleName, + accept, + context); + } + + /** + * Get dismiss rule, with name: {alertsSuppressionRuleName}, for the given subscription. + * + * @param alertsSuppressionRuleName The unique name of the suppression alert rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return dismiss rule, with name: {alertsSuppressionRuleName}, for the given subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String alertsSuppressionRuleName) { + return getWithResponseAsync(alertsSuppressionRuleName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get dismiss rule, with name: {alertsSuppressionRuleName}, for the given subscription. + * + * @param alertsSuppressionRuleName The unique name of the suppression alert rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return dismiss rule, with name: {alertsSuppressionRuleName}, for the given subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AlertsSuppressionRuleInner get(String alertsSuppressionRuleName) { + return getAsync(alertsSuppressionRuleName).block(); + } + + /** + * Get dismiss rule, with name: {alertsSuppressionRuleName}, for the given subscription. + * + * @param alertsSuppressionRuleName The unique name of the suppression alert rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return dismiss rule, with name: {alertsSuppressionRuleName}, for the given subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String alertsSuppressionRuleName, Context context) { + return getWithResponseAsync(alertsSuppressionRuleName, context).block(); + } + + /** + * Update existing rule or create new rule if it doesn't exist. + * + * @param alertsSuppressionRuleName The unique name of the suppression alert rule. + * @param alertsSuppressionRule Suppression rule object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the suppression rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String alertsSuppressionRuleName, AlertsSuppressionRuleInner alertsSuppressionRule) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (alertsSuppressionRuleName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter alertsSuppressionRuleName is required and cannot be null.")); + } + if (alertsSuppressionRule == null) { + return Mono + .error(new IllegalArgumentException("Parameter alertsSuppressionRule is required and cannot be null.")); + } else { + alertsSuppressionRule.validate(); + } + final String apiVersion = "2019-01-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + alertsSuppressionRuleName, + alertsSuppressionRule, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update existing rule or create new rule if it doesn't exist. + * + * @param alertsSuppressionRuleName The unique name of the suppression alert rule. + * @param alertsSuppressionRule Suppression rule object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the suppression rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String alertsSuppressionRuleName, AlertsSuppressionRuleInner alertsSuppressionRule, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (alertsSuppressionRuleName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter alertsSuppressionRuleName is required and cannot be null.")); + } + if (alertsSuppressionRule == null) { + return Mono + .error(new IllegalArgumentException("Parameter alertsSuppressionRule is required and cannot be null.")); + } else { + alertsSuppressionRule.validate(); + } + final String apiVersion = "2019-01-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + alertsSuppressionRuleName, + alertsSuppressionRule, + accept, + context); + } + + /** + * Update existing rule or create new rule if it doesn't exist. + * + * @param alertsSuppressionRuleName The unique name of the suppression alert rule. + * @param alertsSuppressionRule Suppression rule object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the suppression rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String alertsSuppressionRuleName, AlertsSuppressionRuleInner alertsSuppressionRule) { + return updateWithResponseAsync(alertsSuppressionRuleName, alertsSuppressionRule) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Update existing rule or create new rule if it doesn't exist. + * + * @param alertsSuppressionRuleName The unique name of the suppression alert rule. + * @param alertsSuppressionRule Suppression rule object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the suppression rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AlertsSuppressionRuleInner update( + String alertsSuppressionRuleName, AlertsSuppressionRuleInner alertsSuppressionRule) { + return updateAsync(alertsSuppressionRuleName, alertsSuppressionRule).block(); + } + + /** + * Update existing rule or create new rule if it doesn't exist. + * + * @param alertsSuppressionRuleName The unique name of the suppression alert rule. + * @param alertsSuppressionRule Suppression rule object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the suppression rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String alertsSuppressionRuleName, AlertsSuppressionRuleInner alertsSuppressionRule, Context context) { + return updateWithResponseAsync(alertsSuppressionRuleName, alertsSuppressionRule, context).block(); + } + + /** + * Delete dismiss alert rule for this subscription. + * + * @param alertsSuppressionRuleName The unique name of the suppression alert rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String alertsSuppressionRuleName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (alertsSuppressionRuleName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter alertsSuppressionRuleName is required and cannot be null.")); + } + final String apiVersion = "2019-01-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + alertsSuppressionRuleName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete dismiss alert rule for this subscription. + * + * @param alertsSuppressionRuleName The unique name of the suppression alert rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String alertsSuppressionRuleName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (alertsSuppressionRuleName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter alertsSuppressionRuleName is required and cannot be null.")); + } + final String apiVersion = "2019-01-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + alertsSuppressionRuleName, + accept, + context); + } + + /** + * Delete dismiss alert rule for this subscription. + * + * @param alertsSuppressionRuleName The unique name of the suppression alert rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String alertsSuppressionRuleName) { + return deleteWithResponseAsync(alertsSuppressionRuleName).flatMap((Response res) -> Mono.empty()); + } + + /** + * Delete dismiss alert rule for this subscription. + * + * @param alertsSuppressionRuleName The unique name of the suppression alert rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String alertsSuppressionRuleName) { + deleteAsync(alertsSuppressionRuleName).block(); + } + + /** + * Delete dismiss alert rule for this subscription. + * + * @param alertsSuppressionRuleName The unique name of the suppression alert rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String alertsSuppressionRuleName, Context context) { + return deleteWithResponseAsync(alertsSuppressionRuleName, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return suppression rules list for subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return suppression rules list for subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AlertsSuppressionRulesImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AlertsSuppressionRulesImpl.java new file mode 100644 index 000000000000..801c9ace3496 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AlertsSuppressionRulesImpl.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.AlertsSuppressionRulesClient; +import com.azure.resourcemanager.security.fluent.models.AlertsSuppressionRuleInner; +import com.azure.resourcemanager.security.models.AlertsSuppressionRule; +import com.azure.resourcemanager.security.models.AlertsSuppressionRules; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class AlertsSuppressionRulesImpl implements AlertsSuppressionRules { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AlertsSuppressionRulesImpl.class); + + private final AlertsSuppressionRulesClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public AlertsSuppressionRulesImpl( + AlertsSuppressionRulesClient innerClient, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new AlertsSuppressionRuleImpl(inner1, this.manager())); + } + + public PagedIterable list(String alertType, Context context) { + PagedIterable inner = this.serviceClient().list(alertType, context); + return Utils.mapPage(inner, inner1 -> new AlertsSuppressionRuleImpl(inner1, this.manager())); + } + + public AlertsSuppressionRule get(String alertsSuppressionRuleName) { + AlertsSuppressionRuleInner inner = this.serviceClient().get(alertsSuppressionRuleName); + if (inner != null) { + return new AlertsSuppressionRuleImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse(String alertsSuppressionRuleName, Context context) { + Response inner = + this.serviceClient().getWithResponse(alertsSuppressionRuleName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new AlertsSuppressionRuleImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public AlertsSuppressionRule update( + String alertsSuppressionRuleName, AlertsSuppressionRuleInner alertsSuppressionRule) { + AlertsSuppressionRuleInner inner = + this.serviceClient().update(alertsSuppressionRuleName, alertsSuppressionRule); + if (inner != null) { + return new AlertsSuppressionRuleImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response updateWithResponse( + String alertsSuppressionRuleName, AlertsSuppressionRuleInner alertsSuppressionRule, Context context) { + Response inner = + this.serviceClient().updateWithResponse(alertsSuppressionRuleName, alertsSuppressionRule, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new AlertsSuppressionRuleImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String alertsSuppressionRuleName) { + this.serviceClient().delete(alertsSuppressionRuleName); + } + + public Response deleteWithResponse(String alertsSuppressionRuleName, Context context) { + return this.serviceClient().deleteWithResponse(alertsSuppressionRuleName, context); + } + + private AlertsSuppressionRulesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AllowedConnectionsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AllowedConnectionsClientImpl.java new file mode 100644 index 000000000000..000ac7d8d519 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AllowedConnectionsClientImpl.java @@ -0,0 +1,748 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.AllowedConnectionsClient; +import com.azure.resourcemanager.security.fluent.models.AllowedConnectionsResourceInner; +import com.azure.resourcemanager.security.models.AllowedConnectionsList; +import com.azure.resourcemanager.security.models.ConnectionType; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in AllowedConnectionsClient. */ +public final class AllowedConnectionsClientImpl implements AllowedConnectionsClient { + private final ClientLogger logger = new ClientLogger(AllowedConnectionsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final AllowedConnectionsService service; + + /** The service client containing this operation class. */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of AllowedConnectionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + AllowedConnectionsClientImpl(SecurityCenterImpl client) { + this.service = + RestProxy.create(AllowedConnectionsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterAllowedConnections to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityCenterAllowe") + private interface AllowedConnectionsService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/allowedConnections") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/allowedConnections") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByHomeRegion( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("ascLocation") String ascLocation, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations" + + "/{ascLocation}/allowedConnections/{connectionType}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("ascLocation") String ascLocation, + @PathParam("connectionType") ConnectionType connectionType, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByHomeRegionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets the list of all possible traffic between resources for the subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of all possible traffic between resources for the subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list(this.client.getEndpoint(), this.client.getSubscriptionId(), apiVersion, accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the list of all possible traffic between resources for the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of all possible traffic between resources for the subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getSubscriptionId(), apiVersion, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets the list of all possible traffic between resources for the subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of all possible traffic between resources for the subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets the list of all possible traffic between resources for the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of all possible traffic between resources for the subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets the list of all possible traffic between resources for the subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of all possible traffic between resources for the subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Gets the list of all possible traffic between resources for the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of all possible traffic between resources for the subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Gets the list of all possible traffic between resources for the subscription and location. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of all possible traffic between resources for the subscription and location. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByHomeRegionSinglePageAsync(String ascLocation) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (ascLocation == null) { + return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByHomeRegion( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + ascLocation, + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the list of all possible traffic between resources for the subscription and location. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of all possible traffic between resources for the subscription and location. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByHomeRegionSinglePageAsync( + String ascLocation, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (ascLocation == null) { + return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByHomeRegion( + this.client.getEndpoint(), this.client.getSubscriptionId(), ascLocation, apiVersion, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets the list of all possible traffic between resources for the subscription and location. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of all possible traffic between resources for the subscription and location. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByHomeRegionAsync(String ascLocation) { + return new PagedFlux<>( + () -> listByHomeRegionSinglePageAsync(ascLocation), + nextLink -> listByHomeRegionNextSinglePageAsync(nextLink)); + } + + /** + * Gets the list of all possible traffic between resources for the subscription and location. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of all possible traffic between resources for the subscription and location. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByHomeRegionAsync(String ascLocation, Context context) { + return new PagedFlux<>( + () -> listByHomeRegionSinglePageAsync(ascLocation, context), + nextLink -> listByHomeRegionNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets the list of all possible traffic between resources for the subscription and location. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of all possible traffic between resources for the subscription and location. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByHomeRegion(String ascLocation) { + return new PagedIterable<>(listByHomeRegionAsync(ascLocation)); + } + + /** + * Gets the list of all possible traffic between resources for the subscription and location. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of all possible traffic between resources for the subscription and location. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByHomeRegion(String ascLocation, Context context) { + return new PagedIterable<>(listByHomeRegionAsync(ascLocation, context)); + } + + /** + * Gets the list of all possible traffic between resources for the subscription and location, based on connection + * type. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param connectionType The type of allowed connections (Internal, External). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of all possible traffic between resources for the subscription and location, based on connection + * type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String ascLocation, ConnectionType connectionType) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (ascLocation == null) { + return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + if (connectionType == null) { + return Mono.error(new IllegalArgumentException("Parameter connectionType is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + ascLocation, + connectionType, + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the list of all possible traffic between resources for the subscription and location, based on connection + * type. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param connectionType The type of allowed connections (Internal, External). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of all possible traffic between resources for the subscription and location, based on connection + * type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String ascLocation, ConnectionType connectionType, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (ascLocation == null) { + return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + if (connectionType == null) { + return Mono.error(new IllegalArgumentException("Parameter connectionType is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + ascLocation, + connectionType, + apiVersion, + accept, + context); + } + + /** + * Gets the list of all possible traffic between resources for the subscription and location, based on connection + * type. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param connectionType The type of allowed connections (Internal, External). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of all possible traffic between resources for the subscription and location, based on connection + * type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String ascLocation, ConnectionType connectionType) { + return getWithResponseAsync(resourceGroupName, ascLocation, connectionType) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the list of all possible traffic between resources for the subscription and location, based on connection + * type. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param connectionType The type of allowed connections (Internal, External). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of all possible traffic between resources for the subscription and location, based on connection + * type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AllowedConnectionsResourceInner get( + String resourceGroupName, String ascLocation, ConnectionType connectionType) { + return getAsync(resourceGroupName, ascLocation, connectionType).block(); + } + + /** + * Gets the list of all possible traffic between resources for the subscription and location, based on connection + * type. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param connectionType The type of allowed connections (Internal, External). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of all possible traffic between resources for the subscription and location, based on connection + * type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String ascLocation, ConnectionType connectionType, Context context) { + return getWithResponseAsync(resourceGroupName, ascLocation, connectionType, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of all possible traffic between Azure resources. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of all possible traffic between Azure resources. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of all possible traffic between Azure resources. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByHomeRegionNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByHomeRegionNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of all possible traffic between Azure resources. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByHomeRegionNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByHomeRegionNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AllowedConnectionsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AllowedConnectionsImpl.java new file mode 100644 index 000000000000..d3a0b1ce9406 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AllowedConnectionsImpl.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.AllowedConnectionsClient; +import com.azure.resourcemanager.security.fluent.models.AllowedConnectionsResourceInner; +import com.azure.resourcemanager.security.models.AllowedConnections; +import com.azure.resourcemanager.security.models.AllowedConnectionsResource; +import com.azure.resourcemanager.security.models.ConnectionType; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class AllowedConnectionsImpl implements AllowedConnections { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AllowedConnectionsImpl.class); + + private final AllowedConnectionsClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public AllowedConnectionsImpl( + AllowedConnectionsClient innerClient, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new AllowedConnectionsResourceImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new AllowedConnectionsResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByHomeRegion(String ascLocation) { + PagedIterable inner = this.serviceClient().listByHomeRegion(ascLocation); + return Utils.mapPage(inner, inner1 -> new AllowedConnectionsResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByHomeRegion(String ascLocation, Context context) { + PagedIterable inner = + this.serviceClient().listByHomeRegion(ascLocation, context); + return Utils.mapPage(inner, inner1 -> new AllowedConnectionsResourceImpl(inner1, this.manager())); + } + + public AllowedConnectionsResource get(String resourceGroupName, String ascLocation, ConnectionType connectionType) { + AllowedConnectionsResourceInner inner = + this.serviceClient().get(resourceGroupName, ascLocation, connectionType); + if (inner != null) { + return new AllowedConnectionsResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String ascLocation, ConnectionType connectionType, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, ascLocation, connectionType, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new AllowedConnectionsResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private AllowedConnectionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AllowedConnectionsResourceImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AllowedConnectionsResourceImpl.java new file mode 100644 index 000000000000..81e391fcebcd --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AllowedConnectionsResourceImpl.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.resourcemanager.security.fluent.models.AllowedConnectionsResourceInner; +import com.azure.resourcemanager.security.models.AllowedConnectionsResource; +import com.azure.resourcemanager.security.models.ConnectableResource; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; + +public final class AllowedConnectionsResourceImpl implements AllowedConnectionsResource { + private AllowedConnectionsResourceInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + AllowedConnectionsResourceImpl( + AllowedConnectionsResourceInner innerObject, + com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public OffsetDateTime calculatedDateTime() { + return this.innerModel().calculatedDateTime(); + } + + public List connectableResources() { + List inner = this.innerModel().connectableResources(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public String location() { + return this.innerModel().location(); + } + + public AllowedConnectionsResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AscLocationImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AscLocationImpl.java new file mode 100644 index 000000000000..557b0b5b19e0 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AscLocationImpl.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.resourcemanager.security.fluent.models.AscLocationInner; +import com.azure.resourcemanager.security.models.AscLocation; + +public final class AscLocationImpl implements AscLocation { + private AscLocationInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + AscLocationImpl(AscLocationInner innerObject, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public Object properties() { + return this.innerModel().properties(); + } + + public AscLocationInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AssessmentsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AssessmentsClientImpl.java new file mode 100644 index 000000000000..8d3ba78f14a6 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AssessmentsClientImpl.java @@ -0,0 +1,753 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.AssessmentsClient; +import com.azure.resourcemanager.security.fluent.models.SecurityAssessmentInner; +import com.azure.resourcemanager.security.models.ExpandEnum; +import com.azure.resourcemanager.security.models.SecurityAssessmentList; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in AssessmentsClient. */ +public final class AssessmentsClientImpl implements AssessmentsClient { + private final ClientLogger logger = new ClientLogger(AssessmentsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final AssessmentsService service; + + /** The service client containing this operation class. */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of AssessmentsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + AssessmentsClientImpl(SecurityCenterImpl client) { + this.service = + RestProxy.create(AssessmentsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterAssessments to be used by the proxy service to perform + * REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityCenterAssess") + private interface AssessmentsService { + @Headers({"Content-Type: application/json"}) + @Get("/{scope}/providers/Microsoft.Security/assessments") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "scope", encoded = true) String scope, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/{resourceId}/providers/Microsoft.Security/assessments/{assessmentName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceId", encoded = true) String resourceId, + @PathParam("assessmentName") String assessmentName, + @QueryParam("$expand") ExpandEnum expand, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put("/{resourceId}/providers/Microsoft.Security/assessments/{assessmentName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceId", encoded = true) String resourceId, + @PathParam("assessmentName") String assessmentName, + @BodyParam("application/json") SecurityAssessmentInner assessment, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete("/{resourceId}/providers/Microsoft.Security/assessments/{assessmentName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceId", encoded = true) String resourceId, + @PathParam("assessmentName") String assessmentName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Get security assessments on all your scanned resources inside a scope. + * + * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return security assessments on all your scanned resources inside a scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String scope) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), apiVersion, scope, accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get security assessments on all your scanned resources inside a scope. + * + * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return security assessments on all your scanned resources inside a scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String scope, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), apiVersion, scope, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get security assessments on all your scanned resources inside a scope. + * + * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return security assessments on all your scanned resources inside a scope. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String scope) { + return new PagedFlux<>(() -> listSinglePageAsync(scope), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Get security assessments on all your scanned resources inside a scope. + * + * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return security assessments on all your scanned resources inside a scope. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String scope, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(scope, context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Get security assessments on all your scanned resources inside a scope. + * + * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return security assessments on all your scanned resources inside a scope. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String scope) { + return new PagedIterable<>(listAsync(scope)); + } + + /** + * Get security assessments on all your scanned resources inside a scope. + * + * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return security assessments on all your scanned resources inside a scope. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String scope, Context context) { + return new PagedIterable<>(listAsync(scope, context)); + } + + /** + * Get a security assessment on your scanned resource. + * + * @param resourceId The identifier of the resource. + * @param assessmentName The Assessment Key - Unique key for the assessment type. + * @param expand OData expand. Optional. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a security assessment on your scanned resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceId, String assessmentName, ExpandEnum expand) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceId == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); + } + if (assessmentName == null) { + return Mono.error(new IllegalArgumentException("Parameter assessmentName is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), apiVersion, resourceId, assessmentName, expand, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a security assessment on your scanned resource. + * + * @param resourceId The identifier of the resource. + * @param assessmentName The Assessment Key - Unique key for the assessment type. + * @param expand OData expand. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a security assessment on your scanned resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceId, String assessmentName, ExpandEnum expand, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceId == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); + } + if (assessmentName == null) { + return Mono.error(new IllegalArgumentException("Parameter assessmentName is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), apiVersion, resourceId, assessmentName, expand, accept, context); + } + + /** + * Get a security assessment on your scanned resource. + * + * @param resourceId The identifier of the resource. + * @param assessmentName The Assessment Key - Unique key for the assessment type. + * @param expand OData expand. Optional. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a security assessment on your scanned resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceId, String assessmentName, ExpandEnum expand) { + return getWithResponseAsync(resourceId, assessmentName, expand) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get a security assessment on your scanned resource. + * + * @param resourceId The identifier of the resource. + * @param assessmentName The Assessment Key - Unique key for the assessment type. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a security assessment on your scanned resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceId, String assessmentName) { + final ExpandEnum expand = null; + return getWithResponseAsync(resourceId, assessmentName, expand) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get a security assessment on your scanned resource. + * + * @param resourceId The identifier of the resource. + * @param assessmentName The Assessment Key - Unique key for the assessment type. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a security assessment on your scanned resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SecurityAssessmentInner get(String resourceId, String assessmentName) { + final ExpandEnum expand = null; + return getAsync(resourceId, assessmentName, expand).block(); + } + + /** + * Get a security assessment on your scanned resource. + * + * @param resourceId The identifier of the resource. + * @param assessmentName The Assessment Key - Unique key for the assessment type. + * @param expand OData expand. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a security assessment on your scanned resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceId, String assessmentName, ExpandEnum expand, Context context) { + return getWithResponseAsync(resourceId, assessmentName, expand, context).block(); + } + + /** + * Create a security assessment on your resource. An assessment metadata that describes this assessment must be + * predefined with the same name before inserting the assessment result. + * + * @param resourceId The identifier of the resource. + * @param assessmentName The Assessment Key - Unique key for the assessment type. + * @param assessment Calculated assessment on a pre-defined assessment metadata. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return security assessment on a resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceId, String assessmentName, SecurityAssessmentInner assessment) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceId == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); + } + if (assessmentName == null) { + return Mono.error(new IllegalArgumentException("Parameter assessmentName is required and cannot be null.")); + } + if (assessment == null) { + return Mono.error(new IllegalArgumentException("Parameter assessment is required and cannot be null.")); + } else { + assessment.validate(); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + apiVersion, + resourceId, + assessmentName, + assessment, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create a security assessment on your resource. An assessment metadata that describes this assessment must be + * predefined with the same name before inserting the assessment result. + * + * @param resourceId The identifier of the resource. + * @param assessmentName The Assessment Key - Unique key for the assessment type. + * @param assessment Calculated assessment on a pre-defined assessment metadata. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return security assessment on a resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceId, String assessmentName, SecurityAssessmentInner assessment, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceId == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); + } + if (assessmentName == null) { + return Mono.error(new IllegalArgumentException("Parameter assessmentName is required and cannot be null.")); + } + if (assessment == null) { + return Mono.error(new IllegalArgumentException("Parameter assessment is required and cannot be null.")); + } else { + assessment.validate(); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), apiVersion, resourceId, assessmentName, assessment, accept, context); + } + + /** + * Create a security assessment on your resource. An assessment metadata that describes this assessment must be + * predefined with the same name before inserting the assessment result. + * + * @param resourceId The identifier of the resource. + * @param assessmentName The Assessment Key - Unique key for the assessment type. + * @param assessment Calculated assessment on a pre-defined assessment metadata. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return security assessment on a resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceId, String assessmentName, SecurityAssessmentInner assessment) { + return createOrUpdateWithResponseAsync(resourceId, assessmentName, assessment) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Create a security assessment on your resource. An assessment metadata that describes this assessment must be + * predefined with the same name before inserting the assessment result. + * + * @param resourceId The identifier of the resource. + * @param assessmentName The Assessment Key - Unique key for the assessment type. + * @param assessment Calculated assessment on a pre-defined assessment metadata. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return security assessment on a resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SecurityAssessmentInner createOrUpdate( + String resourceId, String assessmentName, SecurityAssessmentInner assessment) { + return createOrUpdateAsync(resourceId, assessmentName, assessment).block(); + } + + /** + * Create a security assessment on your resource. An assessment metadata that describes this assessment must be + * predefined with the same name before inserting the assessment result. + * + * @param resourceId The identifier of the resource. + * @param assessmentName The Assessment Key - Unique key for the assessment type. + * @param assessment Calculated assessment on a pre-defined assessment metadata. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return security assessment on a resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceId, String assessmentName, SecurityAssessmentInner assessment, Context context) { + return createOrUpdateWithResponseAsync(resourceId, assessmentName, assessment, context).block(); + } + + /** + * Delete a security assessment on your resource. An assessment metadata that describes this assessment must be + * predefined with the same name before inserting the assessment result. + * + * @param resourceId The identifier of the resource. + * @param assessmentName The Assessment Key - Unique key for the assessment type. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceId, String assessmentName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceId == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); + } + if (assessmentName == null) { + return Mono.error(new IllegalArgumentException("Parameter assessmentName is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service.delete(this.client.getEndpoint(), apiVersion, resourceId, assessmentName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a security assessment on your resource. An assessment metadata that describes this assessment must be + * predefined with the same name before inserting the assessment result. + * + * @param resourceId The identifier of the resource. + * @param assessmentName The Assessment Key - Unique key for the assessment type. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceId, String assessmentName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceId == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); + } + if (assessmentName == null) { + return Mono.error(new IllegalArgumentException("Parameter assessmentName is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), apiVersion, resourceId, assessmentName, accept, context); + } + + /** + * Delete a security assessment on your resource. An assessment metadata that describes this assessment must be + * predefined with the same name before inserting the assessment result. + * + * @param resourceId The identifier of the resource. + * @param assessmentName The Assessment Key - Unique key for the assessment type. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceId, String assessmentName) { + return deleteWithResponseAsync(resourceId, assessmentName).flatMap((Response res) -> Mono.empty()); + } + + /** + * Delete a security assessment on your resource. An assessment metadata that describes this assessment must be + * predefined with the same name before inserting the assessment result. + * + * @param resourceId The identifier of the resource. + * @param assessmentName The Assessment Key - Unique key for the assessment type. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceId, String assessmentName) { + deleteAsync(resourceId, assessmentName).block(); + } + + /** + * Delete a security assessment on your resource. An assessment metadata that describes this assessment must be + * predefined with the same name before inserting the assessment result. + * + * @param resourceId The identifier of the resource. + * @param assessmentName The Assessment Key - Unique key for the assessment type. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String resourceId, String assessmentName, Context context) { + return deleteWithResponseAsync(resourceId, assessmentName, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return page of a security assessments list. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return page of a security assessments list. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AssessmentsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AssessmentsImpl.java new file mode 100644 index 000000000000..28f8bba8be03 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AssessmentsImpl.java @@ -0,0 +1,182 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.AssessmentsClient; +import com.azure.resourcemanager.security.fluent.models.SecurityAssessmentInner; +import com.azure.resourcemanager.security.models.Assessments; +import com.azure.resourcemanager.security.models.ExpandEnum; +import com.azure.resourcemanager.security.models.SecurityAssessment; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class AssessmentsImpl implements Assessments { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AssessmentsImpl.class); + + private final AssessmentsClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public AssessmentsImpl( + AssessmentsClient innerClient, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String scope) { + PagedIterable inner = this.serviceClient().list(scope); + return Utils.mapPage(inner, inner1 -> new SecurityAssessmentImpl(inner1, this.manager())); + } + + public PagedIterable list(String scope, Context context) { + PagedIterable inner = this.serviceClient().list(scope, context); + return Utils.mapPage(inner, inner1 -> new SecurityAssessmentImpl(inner1, this.manager())); + } + + public SecurityAssessment get(String resourceId, String assessmentName) { + SecurityAssessmentInner inner = this.serviceClient().get(resourceId, assessmentName); + if (inner != null) { + return new SecurityAssessmentImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceId, String assessmentName, ExpandEnum expand, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceId, assessmentName, expand, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new SecurityAssessmentImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceId, String assessmentName) { + this.serviceClient().delete(resourceId, assessmentName); + } + + public Response deleteWithResponse(String resourceId, String assessmentName, Context context) { + return this.serviceClient().deleteWithResponse(resourceId, assessmentName, context); + } + + public SecurityAssessment getById(String id) { + String resourceId = + Utils + .getValueFromIdByParameterName( + id, "/{resourceId}/providers/Microsoft.Security/assessments/{assessmentName}", "resourceId"); + if (resourceId == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceId'.", id))); + } + String assessmentName = + Utils + .getValueFromIdByParameterName( + id, "/{resourceId}/providers/Microsoft.Security/assessments/{assessmentName}", "assessmentName"); + if (assessmentName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'assessments'.", id))); + } + ExpandEnum localExpand = null; + return this.getWithResponse(resourceId, assessmentName, localExpand, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, ExpandEnum expand, Context context) { + String resourceId = + Utils + .getValueFromIdByParameterName( + id, "/{resourceId}/providers/Microsoft.Security/assessments/{assessmentName}", "resourceId"); + if (resourceId == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceId'.", id))); + } + String assessmentName = + Utils + .getValueFromIdByParameterName( + id, "/{resourceId}/providers/Microsoft.Security/assessments/{assessmentName}", "assessmentName"); + if (assessmentName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'assessments'.", id))); + } + return this.getWithResponse(resourceId, assessmentName, expand, context); + } + + public void deleteById(String id) { + String resourceId = + Utils + .getValueFromIdByParameterName( + id, "/{resourceId}/providers/Microsoft.Security/assessments/{assessmentName}", "resourceId"); + if (resourceId == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceId'.", id))); + } + String assessmentName = + Utils + .getValueFromIdByParameterName( + id, "/{resourceId}/providers/Microsoft.Security/assessments/{assessmentName}", "assessmentName"); + if (assessmentName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'assessments'.", id))); + } + this.deleteWithResponse(resourceId, assessmentName, Context.NONE).getValue(); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceId = + Utils + .getValueFromIdByParameterName( + id, "/{resourceId}/providers/Microsoft.Security/assessments/{assessmentName}", "resourceId"); + if (resourceId == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceId'.", id))); + } + String assessmentName = + Utils + .getValueFromIdByParameterName( + id, "/{resourceId}/providers/Microsoft.Security/assessments/{assessmentName}", "assessmentName"); + if (assessmentName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'assessments'.", id))); + } + return this.deleteWithResponse(resourceId, assessmentName, context); + } + + private AssessmentsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } + + public SecurityAssessmentImpl define(String name) { + return new SecurityAssessmentImpl(name, this.manager()); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AssessmentsMetadatasClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AssessmentsMetadatasClientImpl.java new file mode 100644 index 000000000000..ac3a2f2b5cae --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AssessmentsMetadatasClientImpl.java @@ -0,0 +1,1100 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.AssessmentsMetadatasClient; +import com.azure.resourcemanager.security.fluent.models.SecurityAssessmentMetadataInner; +import com.azure.resourcemanager.security.models.SecurityAssessmentMetadataList; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in AssessmentsMetadatasClient. */ +public final class AssessmentsMetadatasClientImpl implements AssessmentsMetadatasClient { + private final ClientLogger logger = new ClientLogger(AssessmentsMetadatasClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final AssessmentsMetadatasService service; + + /** The service client containing this operation class. */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of AssessmentsMetadatasClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + AssessmentsMetadatasClientImpl(SecurityCenterImpl client) { + this.service = + RestProxy + .create(AssessmentsMetadatasService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterAssessmentsMetadatas to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityCenterAssess") + private interface AssessmentsMetadatasService { + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.Security/assessmentMetadata") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("assessmentMetadataName") String assessmentMetadataName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/assessmentMetadata") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscription( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getInSubscription( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("assessmentMetadataName") String assessmentMetadataName, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put("/subscriptions/{subscriptionId}/providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createInSubscription( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("assessmentMetadataName") String assessmentMetadataName, + @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") SecurityAssessmentMetadataInner assessmentMetadata, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> deleteInSubscription( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("assessmentMetadataName") String assessmentMetadataName, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Get metadata information on all assessment types. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return metadata information on all assessment types. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), apiVersion, accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get metadata information on all assessment types. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return metadata information on all assessment types. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), apiVersion, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get metadata information on all assessment types. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return metadata information on all assessment types. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Get metadata information on all assessment types. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return metadata information on all assessment types. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Get metadata information on all assessment types. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return metadata information on all assessment types. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Get metadata information on all assessment types. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return metadata information on all assessment types. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Get metadata information on an assessment type. + * + * @param assessmentMetadataName The Assessment Key - Unique key for the assessment type. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return metadata information on an assessment type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String assessmentMetadataName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (assessmentMetadataName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter assessmentMetadataName is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.get(this.client.getEndpoint(), apiVersion, assessmentMetadataName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get metadata information on an assessment type. + * + * @param assessmentMetadataName The Assessment Key - Unique key for the assessment type. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return metadata information on an assessment type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String assessmentMetadataName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (assessmentMetadataName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter assessmentMetadataName is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), apiVersion, assessmentMetadataName, accept, context); + } + + /** + * Get metadata information on an assessment type. + * + * @param assessmentMetadataName The Assessment Key - Unique key for the assessment type. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return metadata information on an assessment type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String assessmentMetadataName) { + return getWithResponseAsync(assessmentMetadataName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get metadata information on an assessment type. + * + * @param assessmentMetadataName The Assessment Key - Unique key for the assessment type. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return metadata information on an assessment type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SecurityAssessmentMetadataInner get(String assessmentMetadataName) { + return getAsync(assessmentMetadataName).block(); + } + + /** + * Get metadata information on an assessment type. + * + * @param assessmentMetadataName The Assessment Key - Unique key for the assessment type. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return metadata information on an assessment type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String assessmentMetadataName, Context context) { + return getWithResponseAsync(assessmentMetadataName, context).block(); + } + + /** + * Get metadata information on all assessment types in a specific subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return metadata information on all assessment types in a specific subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listBySubscription( + this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get metadata information on all assessment types in a specific subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return metadata information on all assessment types in a specific subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listBySubscription(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get metadata information on all assessment types in a specific subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return metadata information on all assessment types in a specific subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listBySubscriptionAsync() { + return new PagedFlux<>( + () -> listBySubscriptionSinglePageAsync(), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * Get metadata information on all assessment types in a specific subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return metadata information on all assessment types in a specific subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listBySubscriptionAsync(Context context) { + return new PagedFlux<>( + () -> listBySubscriptionSinglePageAsync(context), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * Get metadata information on all assessment types in a specific subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return metadata information on all assessment types in a specific subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listBySubscription() { + return new PagedIterable<>(listBySubscriptionAsync()); + } + + /** + * Get metadata information on all assessment types in a specific subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return metadata information on all assessment types in a specific subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listBySubscription(Context context) { + return new PagedIterable<>(listBySubscriptionAsync(context)); + } + + /** + * Get metadata information on an assessment type in a specific subscription. + * + * @param assessmentMetadataName The Assessment Key - Unique key for the assessment type. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return metadata information on an assessment type in a specific subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getInSubscriptionWithResponseAsync( + String assessmentMetadataName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (assessmentMetadataName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter assessmentMetadataName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getInSubscription( + this.client.getEndpoint(), + apiVersion, + assessmentMetadataName, + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get metadata information on an assessment type in a specific subscription. + * + * @param assessmentMetadataName The Assessment Key - Unique key for the assessment type. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return metadata information on an assessment type in a specific subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getInSubscriptionWithResponseAsync( + String assessmentMetadataName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (assessmentMetadataName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter assessmentMetadataName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getInSubscription( + this.client.getEndpoint(), + apiVersion, + assessmentMetadataName, + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Get metadata information on an assessment type in a specific subscription. + * + * @param assessmentMetadataName The Assessment Key - Unique key for the assessment type. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return metadata information on an assessment type in a specific subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getInSubscriptionAsync(String assessmentMetadataName) { + return getInSubscriptionWithResponseAsync(assessmentMetadataName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get metadata information on an assessment type in a specific subscription. + * + * @param assessmentMetadataName The Assessment Key - Unique key for the assessment type. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return metadata information on an assessment type in a specific subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SecurityAssessmentMetadataInner getInSubscription(String assessmentMetadataName) { + return getInSubscriptionAsync(assessmentMetadataName).block(); + } + + /** + * Get metadata information on an assessment type in a specific subscription. + * + * @param assessmentMetadataName The Assessment Key - Unique key for the assessment type. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return metadata information on an assessment type in a specific subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getInSubscriptionWithResponse( + String assessmentMetadataName, Context context) { + return getInSubscriptionWithResponseAsync(assessmentMetadataName, context).block(); + } + + /** + * Create metadata information on an assessment type in a specific subscription. + * + * @param assessmentMetadataName The Assessment Key - Unique key for the assessment type. + * @param assessmentMetadata AssessmentMetadata object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return security assessment metadata. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createInSubscriptionWithResponseAsync( + String assessmentMetadataName, SecurityAssessmentMetadataInner assessmentMetadata) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (assessmentMetadataName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter assessmentMetadataName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (assessmentMetadata == null) { + return Mono + .error(new IllegalArgumentException("Parameter assessmentMetadata is required and cannot be null.")); + } else { + assessmentMetadata.validate(); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createInSubscription( + this.client.getEndpoint(), + apiVersion, + assessmentMetadataName, + this.client.getSubscriptionId(), + assessmentMetadata, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create metadata information on an assessment type in a specific subscription. + * + * @param assessmentMetadataName The Assessment Key - Unique key for the assessment type. + * @param assessmentMetadata AssessmentMetadata object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return security assessment metadata. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createInSubscriptionWithResponseAsync( + String assessmentMetadataName, SecurityAssessmentMetadataInner assessmentMetadata, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (assessmentMetadataName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter assessmentMetadataName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (assessmentMetadata == null) { + return Mono + .error(new IllegalArgumentException("Parameter assessmentMetadata is required and cannot be null.")); + } else { + assessmentMetadata.validate(); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createInSubscription( + this.client.getEndpoint(), + apiVersion, + assessmentMetadataName, + this.client.getSubscriptionId(), + assessmentMetadata, + accept, + context); + } + + /** + * Create metadata information on an assessment type in a specific subscription. + * + * @param assessmentMetadataName The Assessment Key - Unique key for the assessment type. + * @param assessmentMetadata AssessmentMetadata object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return security assessment metadata. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createInSubscriptionAsync( + String assessmentMetadataName, SecurityAssessmentMetadataInner assessmentMetadata) { + return createInSubscriptionWithResponseAsync(assessmentMetadataName, assessmentMetadata) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Create metadata information on an assessment type in a specific subscription. + * + * @param assessmentMetadataName The Assessment Key - Unique key for the assessment type. + * @param assessmentMetadata AssessmentMetadata object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return security assessment metadata. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SecurityAssessmentMetadataInner createInSubscription( + String assessmentMetadataName, SecurityAssessmentMetadataInner assessmentMetadata) { + return createInSubscriptionAsync(assessmentMetadataName, assessmentMetadata).block(); + } + + /** + * Create metadata information on an assessment type in a specific subscription. + * + * @param assessmentMetadataName The Assessment Key - Unique key for the assessment type. + * @param assessmentMetadata AssessmentMetadata object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return security assessment metadata. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createInSubscriptionWithResponse( + String assessmentMetadataName, SecurityAssessmentMetadataInner assessmentMetadata, Context context) { + return createInSubscriptionWithResponseAsync(assessmentMetadataName, assessmentMetadata, context).block(); + } + + /** + * Delete metadata information on an assessment type in a specific subscription, will cause the deletion of all the + * assessments of that type in that subscription. + * + * @param assessmentMetadataName The Assessment Key - Unique key for the assessment type. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteInSubscriptionWithResponseAsync(String assessmentMetadataName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (assessmentMetadataName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter assessmentMetadataName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .deleteInSubscription( + this.client.getEndpoint(), + apiVersion, + assessmentMetadataName, + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete metadata information on an assessment type in a specific subscription, will cause the deletion of all the + * assessments of that type in that subscription. + * + * @param assessmentMetadataName The Assessment Key - Unique key for the assessment type. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteInSubscriptionWithResponseAsync(String assessmentMetadataName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (assessmentMetadataName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter assessmentMetadataName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .deleteInSubscription( + this.client.getEndpoint(), + apiVersion, + assessmentMetadataName, + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Delete metadata information on an assessment type in a specific subscription, will cause the deletion of all the + * assessments of that type in that subscription. + * + * @param assessmentMetadataName The Assessment Key - Unique key for the assessment type. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteInSubscriptionAsync(String assessmentMetadataName) { + return deleteInSubscriptionWithResponseAsync(assessmentMetadataName) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Delete metadata information on an assessment type in a specific subscription, will cause the deletion of all the + * assessments of that type in that subscription. + * + * @param assessmentMetadataName The Assessment Key - Unique key for the assessment type. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void deleteInSubscription(String assessmentMetadataName) { + deleteInSubscriptionAsync(assessmentMetadataName).block(); + } + + /** + * Delete metadata information on an assessment type in a specific subscription, will cause the deletion of all the + * assessments of that type in that subscription. + * + * @param assessmentMetadataName The Assessment Key - Unique key for the assessment type. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteInSubscriptionWithResponse(String assessmentMetadataName, Context context) { + return deleteInSubscriptionWithResponseAsync(assessmentMetadataName, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security assessment metadata. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security assessment metadata. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security assessment metadata. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync( + String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security assessment metadata. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AssessmentsMetadatasImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AssessmentsMetadatasImpl.java new file mode 100644 index 000000000000..710b457adbd1 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AssessmentsMetadatasImpl.java @@ -0,0 +1,169 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.AssessmentsMetadatasClient; +import com.azure.resourcemanager.security.fluent.models.SecurityAssessmentMetadataInner; +import com.azure.resourcemanager.security.models.AssessmentsMetadatas; +import com.azure.resourcemanager.security.models.SecurityAssessmentMetadata; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class AssessmentsMetadatasImpl implements AssessmentsMetadatas { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AssessmentsMetadatasImpl.class); + + private final AssessmentsMetadatasClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public AssessmentsMetadatasImpl( + AssessmentsMetadatasClient innerClient, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new SecurityAssessmentMetadataImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new SecurityAssessmentMetadataImpl(inner1, this.manager())); + } + + public SecurityAssessmentMetadata get(String assessmentMetadataName) { + SecurityAssessmentMetadataInner inner = this.serviceClient().get(assessmentMetadataName); + if (inner != null) { + return new SecurityAssessmentMetadataImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse(String assessmentMetadataName, Context context) { + Response inner = + this.serviceClient().getWithResponse(assessmentMetadataName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new SecurityAssessmentMetadataImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable listBySubscription() { + PagedIterable inner = this.serviceClient().listBySubscription(); + return Utils.mapPage(inner, inner1 -> new SecurityAssessmentMetadataImpl(inner1, this.manager())); + } + + public PagedIterable listBySubscription(Context context) { + PagedIterable inner = this.serviceClient().listBySubscription(context); + return Utils.mapPage(inner, inner1 -> new SecurityAssessmentMetadataImpl(inner1, this.manager())); + } + + public SecurityAssessmentMetadata getInSubscription(String assessmentMetadataName) { + SecurityAssessmentMetadataInner inner = this.serviceClient().getInSubscription(assessmentMetadataName); + if (inner != null) { + return new SecurityAssessmentMetadataImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getInSubscriptionWithResponse( + String assessmentMetadataName, Context context) { + Response inner = + this.serviceClient().getInSubscriptionWithResponse(assessmentMetadataName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new SecurityAssessmentMetadataImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deleteInSubscription(String assessmentMetadataName) { + this.serviceClient().deleteInSubscription(assessmentMetadataName); + } + + public Response deleteInSubscriptionWithResponse(String assessmentMetadataName, Context context) { + return this.serviceClient().deleteInSubscriptionWithResponse(assessmentMetadataName, context); + } + + public SecurityAssessmentMetadata getInSubscriptionById(String id) { + String assessmentMetadataName = Utils.getValueFromIdByName(id, "assessmentMetadata"); + if (assessmentMetadataName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'assessmentMetadata'.", id))); + } + return this.getInSubscriptionWithResponse(assessmentMetadataName, Context.NONE).getValue(); + } + + public Response getInSubscriptionByIdWithResponse(String id, Context context) { + String assessmentMetadataName = Utils.getValueFromIdByName(id, "assessmentMetadata"); + if (assessmentMetadataName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'assessmentMetadata'.", id))); + } + return this.getInSubscriptionWithResponse(assessmentMetadataName, context); + } + + public void deleteInSubscriptionById(String id) { + String assessmentMetadataName = Utils.getValueFromIdByName(id, "assessmentMetadata"); + if (assessmentMetadataName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'assessmentMetadata'.", id))); + } + this.deleteInSubscriptionWithResponse(assessmentMetadataName, Context.NONE).getValue(); + } + + public Response deleteInSubscriptionByIdWithResponse(String id, Context context) { + String assessmentMetadataName = Utils.getValueFromIdByName(id, "assessmentMetadata"); + if (assessmentMetadataName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'assessmentMetadata'.", id))); + } + return this.deleteInSubscriptionWithResponse(assessmentMetadataName, context); + } + + private AssessmentsMetadatasClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } + + public SecurityAssessmentMetadataImpl define(String name) { + return new SecurityAssessmentMetadataImpl(name, this.manager()); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AutoProvisioningSettingImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AutoProvisioningSettingImpl.java new file mode 100644 index 000000000000..896c6cbf9791 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AutoProvisioningSettingImpl.java @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.AutoProvisioningSettingInner; +import com.azure.resourcemanager.security.models.AutoProvision; +import com.azure.resourcemanager.security.models.AutoProvisioningSetting; + +public final class AutoProvisioningSettingImpl implements AutoProvisioningSetting, AutoProvisioningSetting.Definition { + private AutoProvisioningSettingInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + AutoProvisioningSettingImpl( + AutoProvisioningSettingInner innerObject, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public AutoProvision autoProvision() { + return this.innerModel().autoProvision(); + } + + public AutoProvisioningSettingInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } + + private String settingName; + + public AutoProvisioningSetting create() { + this.innerObject = + serviceManager + .serviceClient() + .getAutoProvisioningSettings() + .createWithResponse(settingName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public AutoProvisioningSetting create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getAutoProvisioningSettings() + .createWithResponse(settingName, this.innerModel(), context) + .getValue(); + return this; + } + + AutoProvisioningSettingImpl(String name, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = new AutoProvisioningSettingInner(); + this.serviceManager = serviceManager; + this.settingName = name; + } + + public AutoProvisioningSetting refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getAutoProvisioningSettings() + .getWithResponse(settingName, Context.NONE) + .getValue(); + return this; + } + + public AutoProvisioningSetting refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getAutoProvisioningSettings() + .getWithResponse(settingName, context) + .getValue(); + return this; + } + + public AutoProvisioningSettingImpl withAutoProvision(AutoProvision autoProvision) { + this.innerModel().withAutoProvision(autoProvision); + return this; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AutoProvisioningSettingsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AutoProvisioningSettingsClientImpl.java new file mode 100644 index 000000000000..47633aa7fb0e --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AutoProvisioningSettingsClientImpl.java @@ -0,0 +1,595 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.AutoProvisioningSettingsClient; +import com.azure.resourcemanager.security.fluent.models.AutoProvisioningSettingInner; +import com.azure.resourcemanager.security.models.AutoProvisioningSettingList; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in AutoProvisioningSettingsClient. */ +public final class AutoProvisioningSettingsClientImpl implements AutoProvisioningSettingsClient { + private final ClientLogger logger = new ClientLogger(AutoProvisioningSettingsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final AutoProvisioningSettingsService service; + + /** The service client containing this operation class. */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of AutoProvisioningSettingsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + AutoProvisioningSettingsClientImpl(SecurityCenterImpl client) { + this.service = + RestProxy + .create(AutoProvisioningSettingsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterAutoProvisioningSettings to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityCenterAutoPr") + private interface AutoProvisioningSettingsService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/autoProvisioningSettings") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/autoProvisioningSettings/{settingName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("settingName") String settingName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put("/subscriptions/{subscriptionId}/providers/Microsoft.Security/autoProvisioningSettings/{settingName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> create( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("settingName") String settingName, + @BodyParam("application/json") AutoProvisioningSettingInner setting, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Exposes the auto provisioning settings of the subscriptions. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of all the auto provisioning settings response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-08-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Exposes the auto provisioning settings of the subscriptions. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of all the auto provisioning settings response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-08-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Exposes the auto provisioning settings of the subscriptions. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of all the auto provisioning settings response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Exposes the auto provisioning settings of the subscriptions. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of all the auto provisioning settings response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Exposes the auto provisioning settings of the subscriptions. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of all the auto provisioning settings response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Exposes the auto provisioning settings of the subscriptions. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of all the auto provisioning settings response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Details of a specific setting. + * + * @param settingName Auto provisioning setting key. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return auto provisioning setting. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String settingName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (settingName == null) { + return Mono.error(new IllegalArgumentException("Parameter settingName is required and cannot be null.")); + } + final String apiVersion = "2017-08-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + settingName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Details of a specific setting. + * + * @param settingName Auto provisioning setting key. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return auto provisioning setting. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String settingName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (settingName == null) { + return Mono.error(new IllegalArgumentException("Parameter settingName is required and cannot be null.")); + } + final String apiVersion = "2017-08-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), settingName, accept, context); + } + + /** + * Details of a specific setting. + * + * @param settingName Auto provisioning setting key. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return auto provisioning setting. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String settingName) { + return getWithResponseAsync(settingName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Details of a specific setting. + * + * @param settingName Auto provisioning setting key. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return auto provisioning setting. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AutoProvisioningSettingInner get(String settingName) { + return getAsync(settingName).block(); + } + + /** + * Details of a specific setting. + * + * @param settingName Auto provisioning setting key. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return auto provisioning setting. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String settingName, Context context) { + return getWithResponseAsync(settingName, context).block(); + } + + /** + * Details of a specific setting. + * + * @param settingName Auto provisioning setting key. + * @param setting Auto provisioning setting key. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return auto provisioning setting. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync( + String settingName, AutoProvisioningSettingInner setting) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (settingName == null) { + return Mono.error(new IllegalArgumentException("Parameter settingName is required and cannot be null.")); + } + if (setting == null) { + return Mono.error(new IllegalArgumentException("Parameter setting is required and cannot be null.")); + } else { + setting.validate(); + } + final String apiVersion = "2017-08-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .create( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + settingName, + setting, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Details of a specific setting. + * + * @param settingName Auto provisioning setting key. + * @param setting Auto provisioning setting key. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return auto provisioning setting. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync( + String settingName, AutoProvisioningSettingInner setting, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (settingName == null) { + return Mono.error(new IllegalArgumentException("Parameter settingName is required and cannot be null.")); + } + if (setting == null) { + return Mono.error(new IllegalArgumentException("Parameter setting is required and cannot be null.")); + } else { + setting.validate(); + } + final String apiVersion = "2017-08-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .create( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + settingName, + setting, + accept, + context); + } + + /** + * Details of a specific setting. + * + * @param settingName Auto provisioning setting key. + * @param setting Auto provisioning setting key. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return auto provisioning setting. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync(String settingName, AutoProvisioningSettingInner setting) { + return createWithResponseAsync(settingName, setting) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Details of a specific setting. + * + * @param settingName Auto provisioning setting key. + * @param setting Auto provisioning setting key. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return auto provisioning setting. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AutoProvisioningSettingInner create(String settingName, AutoProvisioningSettingInner setting) { + return createAsync(settingName, setting).block(); + } + + /** + * Details of a specific setting. + * + * @param settingName Auto provisioning setting key. + * @param setting Auto provisioning setting key. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return auto provisioning setting. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createWithResponse( + String settingName, AutoProvisioningSettingInner setting, Context context) { + return createWithResponseAsync(settingName, setting, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of all the auto provisioning settings response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of all the auto provisioning settings response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AutoProvisioningSettingsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AutoProvisioningSettingsImpl.java new file mode 100644 index 000000000000..977e36644376 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AutoProvisioningSettingsImpl.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.AutoProvisioningSettingsClient; +import com.azure.resourcemanager.security.fluent.models.AutoProvisioningSettingInner; +import com.azure.resourcemanager.security.models.AutoProvisioningSetting; +import com.azure.resourcemanager.security.models.AutoProvisioningSettings; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class AutoProvisioningSettingsImpl implements AutoProvisioningSettings { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AutoProvisioningSettingsImpl.class); + + private final AutoProvisioningSettingsClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public AutoProvisioningSettingsImpl( + AutoProvisioningSettingsClient innerClient, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new AutoProvisioningSettingImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new AutoProvisioningSettingImpl(inner1, this.manager())); + } + + public AutoProvisioningSetting get(String settingName) { + AutoProvisioningSettingInner inner = this.serviceClient().get(settingName); + if (inner != null) { + return new AutoProvisioningSettingImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse(String settingName, Context context) { + Response inner = this.serviceClient().getWithResponse(settingName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new AutoProvisioningSettingImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public AutoProvisioningSetting getById(String id) { + String settingName = Utils.getValueFromIdByName(id, "autoProvisioningSettings"); + if (settingName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'autoProvisioningSettings'.", + id))); + } + return this.getWithResponse(settingName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String settingName = Utils.getValueFromIdByName(id, "autoProvisioningSettings"); + if (settingName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'autoProvisioningSettings'.", + id))); + } + return this.getWithResponse(settingName, context); + } + + private AutoProvisioningSettingsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } + + public AutoProvisioningSettingImpl define(String name) { + return new AutoProvisioningSettingImpl(name, this.manager()); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AutomationImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AutomationImpl.java new file mode 100644 index 000000000000..805a8fe1fbfd --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AutomationImpl.java @@ -0,0 +1,236 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.AutomationInner; +import com.azure.resourcemanager.security.models.Automation; +import com.azure.resourcemanager.security.models.AutomationAction; +import com.azure.resourcemanager.security.models.AutomationScope; +import com.azure.resourcemanager.security.models.AutomationSource; +import com.azure.resourcemanager.security.models.AutomationValidationStatus; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public final class AutomationImpl implements Automation, Automation.Definition, Automation.Update { + private AutomationInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public String description() { + return this.innerModel().description(); + } + + public Boolean isEnabled() { + return this.innerModel().isEnabled(); + } + + public List scopes() { + List inner = this.innerModel().scopes(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List sources() { + List inner = this.innerModel().sources(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List actions() { + List inner = this.innerModel().actions(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public AutomationInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String automationName; + + public AutomationImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public Automation create() { + this.innerObject = + serviceManager + .serviceClient() + .getAutomations() + .createOrUpdateWithResponse(resourceGroupName, automationName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public Automation create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getAutomations() + .createOrUpdateWithResponse(resourceGroupName, automationName, this.innerModel(), context) + .getValue(); + return this; + } + + AutomationImpl(String name, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = new AutomationInner(); + this.serviceManager = serviceManager; + this.automationName = name; + } + + public AutomationImpl update() { + return this; + } + + public Automation apply() { + this.innerObject = + serviceManager + .serviceClient() + .getAutomations() + .createOrUpdateWithResponse(resourceGroupName, automationName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public Automation apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getAutomations() + .createOrUpdateWithResponse(resourceGroupName, automationName, this.innerModel(), context) + .getValue(); + return this; + } + + AutomationImpl(AutomationInner innerObject, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.automationName = Utils.getValueFromIdByName(innerObject.id(), "automations"); + } + + public Automation refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getAutomations() + .getByResourceGroupWithResponse(resourceGroupName, automationName, Context.NONE) + .getValue(); + return this; + } + + public Automation refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getAutomations() + .getByResourceGroupWithResponse(resourceGroupName, automationName, context) + .getValue(); + return this; + } + + public AutomationValidationStatus validate(AutomationInner automation) { + return serviceManager.automations().validate(resourceGroupName, automationName, automation); + } + + public Response validateWithResponse(AutomationInner automation, Context context) { + return serviceManager + .automations() + .validateWithResponse(resourceGroupName, automationName, automation, context); + } + + public AutomationImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public AutomationImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public AutomationImpl withTags(Map tags) { + this.innerModel().withTags(tags); + return this; + } + + public AutomationImpl withDescription(String description) { + this.innerModel().withDescription(description); + return this; + } + + public AutomationImpl withIsEnabled(Boolean isEnabled) { + this.innerModel().withIsEnabled(isEnabled); + return this; + } + + public AutomationImpl withScopes(List scopes) { + this.innerModel().withScopes(scopes); + return this; + } + + public AutomationImpl withSources(List sources) { + this.innerModel().withSources(sources); + return this; + } + + public AutomationImpl withActions(List actions) { + this.innerModel().withActions(actions); + return this; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AutomationValidationStatusImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AutomationValidationStatusImpl.java new file mode 100644 index 000000000000..5e3c49c7e027 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AutomationValidationStatusImpl.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.resourcemanager.security.fluent.models.AutomationValidationStatusInner; +import com.azure.resourcemanager.security.models.AutomationValidationStatus; + +public final class AutomationValidationStatusImpl implements AutomationValidationStatus { + private AutomationValidationStatusInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + AutomationValidationStatusImpl( + AutomationValidationStatusInner innerObject, + com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public Boolean isValid() { + return this.innerModel().isValid(); + } + + public String message() { + return this.innerModel().message(); + } + + public AutomationValidationStatusInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AutomationsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AutomationsClientImpl.java new file mode 100644 index 000000000000..b502388b8f1f --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AutomationsClientImpl.java @@ -0,0 +1,1293 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.AutomationsClient; +import com.azure.resourcemanager.security.fluent.models.AutomationInner; +import com.azure.resourcemanager.security.fluent.models.AutomationValidationStatusInner; +import com.azure.resourcemanager.security.models.AutomationList; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in AutomationsClient. */ +public final class AutomationsClientImpl implements AutomationsClient { + private final ClientLogger logger = new ClientLogger(AutomationsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final AutomationsService service; + + /** The service client containing this operation class. */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of AutomationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + AutomationsClientImpl(SecurityCenterImpl client) { + this.service = + RestProxy.create(AutomationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterAutomations to be used by the proxy service to perform + * REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityCenterAutoma") + private interface AutomationsService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/automations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security" + + "/automations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security" + + "/automations/{automationName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("automationName") String automationName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security" + + "/automations/{automationName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("automationName") String automationName, + @BodyParam("application/json") AutomationInner automation, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security" + + "/automations/{automationName}") + @ExpectedResponses({204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("automationName") String automationName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security" + + "/automations/{automationName}/validate") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> validate( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("automationName") String automationName, + @BodyParam("application/json") AutomationInner automation, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists all the security automations in the specified subscription. Use the 'nextLink' property in the response to + * get the next page of security automations for the specified subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security automations response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2019-01-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists all the security automations in the specified subscription. Use the 'nextLink' property in the response to + * get the next page of security automations for the specified subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security automations response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2019-01-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists all the security automations in the specified subscription. Use the 'nextLink' property in the response to + * get the next page of security automations for the specified subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security automations response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists all the security automations in the specified subscription. Use the 'nextLink' property in the response to + * get the next page of security automations for the specified subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security automations response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all the security automations in the specified subscription. Use the 'nextLink' property in the response to + * get the next page of security automations for the specified subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security automations response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Lists all the security automations in the specified subscription. Use the 'nextLink' property in the response to + * get the next page of security automations for the specified subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security automations response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Lists all the security automations in the specified resource group. Use the 'nextLink' property in the response + * to get the next page of security automations for the specified resource group. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security automations response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String apiVersion = "2019-01-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists all the security automations in the specified resource group. Use the 'nextLink' property in the response + * to get the next page of security automations for the specified resource group. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security automations response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String apiVersion = "2019-01-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists all the security automations in the specified resource group. Use the 'nextLink' property in the response + * to get the next page of security automations for the specified resource group. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security automations response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Lists all the security automations in the specified resource group. Use the 'nextLink' property in the response + * to get the next page of security automations for the specified resource group. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security automations response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all the security automations in the specified resource group. Use the 'nextLink' property in the response + * to get the next page of security automations for the specified resource group. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security automations response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * Lists all the security automations in the specified resource group. Use the 'nextLink' property in the response + * to get the next page of security automations for the specified resource group. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security automations response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Retrieves information about the model of a security automation. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param automationName The security automation name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the security automation resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String automationName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (automationName == null) { + return Mono.error(new IllegalArgumentException("Parameter automationName is required and cannot be null.")); + } + final String apiVersion = "2019-01-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + automationName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves information about the model of a security automation. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param automationName The security automation name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the security automation resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String automationName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (automationName == null) { + return Mono.error(new IllegalArgumentException("Parameter automationName is required and cannot be null.")); + } + final String apiVersion = "2019-01-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + automationName, + accept, + context); + } + + /** + * Retrieves information about the model of a security automation. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param automationName The security automation name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the security automation resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String automationName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, automationName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Retrieves information about the model of a security automation. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param automationName The security automation name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the security automation resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AutomationInner getByResourceGroup(String resourceGroupName, String automationName) { + return getByResourceGroupAsync(resourceGroupName, automationName).block(); + } + + /** + * Retrieves information about the model of a security automation. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param automationName The security automation name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the security automation resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String automationName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, automationName, context).block(); + } + + /** + * Creates or updates a security automation. If a security automation is already created and a subsequent request is + * issued for the same automation id, then it will be updated. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param automationName The security automation name. + * @param automation The security automation resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the security automation resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, String automationName, AutomationInner automation) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (automationName == null) { + return Mono.error(new IllegalArgumentException("Parameter automationName is required and cannot be null.")); + } + if (automation == null) { + return Mono.error(new IllegalArgumentException("Parameter automation is required and cannot be null.")); + } else { + automation.validate(); + } + final String apiVersion = "2019-01-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + automationName, + automation, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates a security automation. If a security automation is already created and a subsequent request is + * issued for the same automation id, then it will be updated. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param automationName The security automation name. + * @param automation The security automation resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the security automation resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, String automationName, AutomationInner automation, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (automationName == null) { + return Mono.error(new IllegalArgumentException("Parameter automationName is required and cannot be null.")); + } + if (automation == null) { + return Mono.error(new IllegalArgumentException("Parameter automation is required and cannot be null.")); + } else { + automation.validate(); + } + final String apiVersion = "2019-01-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + automationName, + automation, + accept, + context); + } + + /** + * Creates or updates a security automation. If a security automation is already created and a subsequent request is + * issued for the same automation id, then it will be updated. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param automationName The security automation name. + * @param automation The security automation resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the security automation resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String automationName, AutomationInner automation) { + return createOrUpdateWithResponseAsync(resourceGroupName, automationName, automation) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Creates or updates a security automation. If a security automation is already created and a subsequent request is + * issued for the same automation id, then it will be updated. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param automationName The security automation name. + * @param automation The security automation resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the security automation resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AutomationInner createOrUpdate(String resourceGroupName, String automationName, AutomationInner automation) { + return createOrUpdateAsync(resourceGroupName, automationName, automation).block(); + } + + /** + * Creates or updates a security automation. If a security automation is already created and a subsequent request is + * issued for the same automation id, then it will be updated. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param automationName The security automation name. + * @param automation The security automation resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the security automation resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, String automationName, AutomationInner automation, Context context) { + return createOrUpdateWithResponseAsync(resourceGroupName, automationName, automation, context).block(); + } + + /** + * Deletes a security automation. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param automationName The security automation name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String automationName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (automationName == null) { + return Mono.error(new IllegalArgumentException("Parameter automationName is required and cannot be null.")); + } + final String apiVersion = "2019-01-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + automationName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a security automation. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param automationName The security automation name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, String automationName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (automationName == null) { + return Mono.error(new IllegalArgumentException("Parameter automationName is required and cannot be null.")); + } + final String apiVersion = "2019-01-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + automationName, + accept, + context); + } + + /** + * Deletes a security automation. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param automationName The security automation name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String automationName) { + return deleteWithResponseAsync(resourceGroupName, automationName).flatMap((Response res) -> Mono.empty()); + } + + /** + * Deletes a security automation. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param automationName The security automation name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String automationName) { + deleteAsync(resourceGroupName, automationName).block(); + } + + /** + * Deletes a security automation. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param automationName The security automation name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String resourceGroupName, String automationName, Context context) { + return deleteWithResponseAsync(resourceGroupName, automationName, context).block(); + } + + /** + * Validates the security automation model before create or update. Any validation errors are returned to the + * client. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param automationName The security automation name. + * @param automation The security automation resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the security automation model state property bag. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> validateWithResponseAsync( + String resourceGroupName, String automationName, AutomationInner automation) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (automationName == null) { + return Mono.error(new IllegalArgumentException("Parameter automationName is required and cannot be null.")); + } + if (automation == null) { + return Mono.error(new IllegalArgumentException("Parameter automation is required and cannot be null.")); + } else { + automation.validate(); + } + final String apiVersion = "2019-01-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .validate( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + automationName, + automation, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Validates the security automation model before create or update. Any validation errors are returned to the + * client. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param automationName The security automation name. + * @param automation The security automation resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the security automation model state property bag. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> validateWithResponseAsync( + String resourceGroupName, String automationName, AutomationInner automation, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (automationName == null) { + return Mono.error(new IllegalArgumentException("Parameter automationName is required and cannot be null.")); + } + if (automation == null) { + return Mono.error(new IllegalArgumentException("Parameter automation is required and cannot be null.")); + } else { + automation.validate(); + } + final String apiVersion = "2019-01-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .validate( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + automationName, + automation, + accept, + context); + } + + /** + * Validates the security automation model before create or update. Any validation errors are returned to the + * client. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param automationName The security automation name. + * @param automation The security automation resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the security automation model state property bag. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono validateAsync( + String resourceGroupName, String automationName, AutomationInner automation) { + return validateWithResponseAsync(resourceGroupName, automationName, automation) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Validates the security automation model before create or update. Any validation errors are returned to the + * client. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param automationName The security automation name. + * @param automation The security automation resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the security automation model state property bag. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AutomationValidationStatusInner validate( + String resourceGroupName, String automationName, AutomationInner automation) { + return validateAsync(resourceGroupName, automationName, automation).block(); + } + + /** + * Validates the security automation model before create or update. Any validation errors are returned to the + * client. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param automationName The security automation name. + * @param automation The security automation resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the security automation model state property bag. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response validateWithResponse( + String resourceGroupName, String automationName, AutomationInner automation, Context context) { + return validateWithResponseAsync(resourceGroupName, automationName, automation, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security automations response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security automations response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security automations response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security automations response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AutomationsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AutomationsImpl.java new file mode 100644 index 000000000000..9f145dc699d9 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AutomationsImpl.java @@ -0,0 +1,198 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.AutomationsClient; +import com.azure.resourcemanager.security.fluent.models.AutomationInner; +import com.azure.resourcemanager.security.fluent.models.AutomationValidationStatusInner; +import com.azure.resourcemanager.security.models.Automation; +import com.azure.resourcemanager.security.models.AutomationValidationStatus; +import com.azure.resourcemanager.security.models.Automations; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class AutomationsImpl implements Automations { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AutomationsImpl.class); + + private final AutomationsClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public AutomationsImpl( + AutomationsClient innerClient, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new AutomationImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new AutomationImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new AutomationImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new AutomationImpl(inner1, this.manager())); + } + + public Automation getByResourceGroup(String resourceGroupName, String automationName) { + AutomationInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, automationName); + if (inner != null) { + return new AutomationImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String automationName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, automationName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new AutomationImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String automationName) { + this.serviceClient().delete(resourceGroupName, automationName); + } + + public Response deleteWithResponse(String resourceGroupName, String automationName, Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, automationName, context); + } + + public AutomationValidationStatus validate( + String resourceGroupName, String automationName, AutomationInner automation) { + AutomationValidationStatusInner inner = + this.serviceClient().validate(resourceGroupName, automationName, automation); + if (inner != null) { + return new AutomationValidationStatusImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response validateWithResponse( + String resourceGroupName, String automationName, AutomationInner automation, Context context) { + Response inner = + this.serviceClient().validateWithResponse(resourceGroupName, automationName, automation, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new AutomationValidationStatusImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Automation getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String automationName = Utils.getValueFromIdByName(id, "automations"); + if (automationName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'automations'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, automationName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String automationName = Utils.getValueFromIdByName(id, "automations"); + if (automationName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'automations'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, automationName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String automationName = Utils.getValueFromIdByName(id, "automations"); + if (automationName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'automations'.", id))); + } + this.deleteWithResponse(resourceGroupName, automationName, Context.NONE).getValue(); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String automationName = Utils.getValueFromIdByName(id, "automations"); + if (automationName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'automations'.", id))); + } + return this.deleteWithResponse(resourceGroupName, automationName, context); + } + + private AutomationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } + + public AutomationImpl define(String name) { + return new AutomationImpl(name, this.manager()); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ComplianceImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ComplianceImpl.java new file mode 100644 index 000000000000..852c490b819c --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ComplianceImpl.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.resourcemanager.security.fluent.models.ComplianceInner; +import com.azure.resourcemanager.security.models.Compliance; +import com.azure.resourcemanager.security.models.ComplianceSegment; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; + +public final class ComplianceImpl implements Compliance { + private ComplianceInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + ComplianceImpl(ComplianceInner innerObject, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public OffsetDateTime assessmentTimestampUtcDate() { + return this.innerModel().assessmentTimestampUtcDate(); + } + + public Integer resourceCount() { + return this.innerModel().resourceCount(); + } + + public List assessmentResult() { + List inner = this.innerModel().assessmentResult(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public ComplianceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ComplianceResultImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ComplianceResultImpl.java new file mode 100644 index 000000000000..dd6a7518892a --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ComplianceResultImpl.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.resourcemanager.security.fluent.models.ComplianceResultInner; +import com.azure.resourcemanager.security.models.ComplianceResult; +import com.azure.resourcemanager.security.models.ResourceStatus; + +public final class ComplianceResultImpl implements ComplianceResult { + private ComplianceResultInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + ComplianceResultImpl( + ComplianceResultInner innerObject, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public ResourceStatus resourceStatus() { + return this.innerModel().resourceStatus(); + } + + public ComplianceResultInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ComplianceResultsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ComplianceResultsClientImpl.java new file mode 100644 index 000000000000..7a4302c6ace9 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ComplianceResultsClientImpl.java @@ -0,0 +1,427 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.ComplianceResultsClient; +import com.azure.resourcemanager.security.fluent.models.ComplianceResultInner; +import com.azure.resourcemanager.security.models.ComplianceResultList; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ComplianceResultsClient. */ +public final class ComplianceResultsClientImpl implements ComplianceResultsClient { + private final ClientLogger logger = new ClientLogger(ComplianceResultsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ComplianceResultsService service; + + /** The service client containing this operation class. */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of ComplianceResultsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ComplianceResultsClientImpl(SecurityCenterImpl client) { + this.service = + RestProxy.create(ComplianceResultsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterComplianceResults to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityCenterCompli") + private interface ComplianceResultsService { + @Headers({"Content-Type: application/json"}) + @Get("/{scope}/providers/Microsoft.Security/complianceResults") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "scope", encoded = true) String scope, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/{resourceId}/providers/Microsoft.Security/complianceResults/{complianceResultName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceId", encoded = true) String resourceId, + @PathParam("complianceResultName") String complianceResultName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Security compliance results in the subscription. + * + * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of compliance results response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String scope) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + final String apiVersion = "2017-08-01"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), apiVersion, scope, accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Security compliance results in the subscription. + * + * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of compliance results response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String scope, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + final String apiVersion = "2017-08-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), apiVersion, scope, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Security compliance results in the subscription. + * + * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of compliance results response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String scope) { + return new PagedFlux<>(() -> listSinglePageAsync(scope), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Security compliance results in the subscription. + * + * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of compliance results response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String scope, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(scope, context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Security compliance results in the subscription. + * + * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of compliance results response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String scope) { + return new PagedIterable<>(listAsync(scope)); + } + + /** + * Security compliance results in the subscription. + * + * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of compliance results response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String scope, Context context) { + return new PagedIterable<>(listAsync(scope, context)); + } + + /** + * Security Compliance Result. + * + * @param resourceId The identifier of the resource. + * @param complianceResultName name of the desired assessment compliance result. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a compliance result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceId, String complianceResultName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceId == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); + } + if (complianceResultName == null) { + return Mono + .error(new IllegalArgumentException("Parameter complianceResultName is required and cannot be null.")); + } + final String apiVersion = "2017-08-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get(this.client.getEndpoint(), apiVersion, resourceId, complianceResultName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Security Compliance Result. + * + * @param resourceId The identifier of the resource. + * @param complianceResultName name of the desired assessment compliance result. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a compliance result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceId, String complianceResultName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceId == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); + } + if (complianceResultName == null) { + return Mono + .error(new IllegalArgumentException("Parameter complianceResultName is required and cannot be null.")); + } + final String apiVersion = "2017-08-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), apiVersion, resourceId, complianceResultName, accept, context); + } + + /** + * Security Compliance Result. + * + * @param resourceId The identifier of the resource. + * @param complianceResultName name of the desired assessment compliance result. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a compliance result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceId, String complianceResultName) { + return getWithResponseAsync(resourceId, complianceResultName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Security Compliance Result. + * + * @param resourceId The identifier of the resource. + * @param complianceResultName name of the desired assessment compliance result. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a compliance result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ComplianceResultInner get(String resourceId, String complianceResultName) { + return getAsync(resourceId, complianceResultName).block(); + } + + /** + * Security Compliance Result. + * + * @param resourceId The identifier of the resource. + * @param complianceResultName name of the desired assessment compliance result. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a compliance result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceId, String complianceResultName, Context context) { + return getWithResponseAsync(resourceId, complianceResultName, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of compliance results response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of compliance results response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ComplianceResultsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ComplianceResultsImpl.java new file mode 100644 index 000000000000..5378d825e06d --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ComplianceResultsImpl.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.ComplianceResultsClient; +import com.azure.resourcemanager.security.fluent.models.ComplianceResultInner; +import com.azure.resourcemanager.security.models.ComplianceResult; +import com.azure.resourcemanager.security.models.ComplianceResults; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ComplianceResultsImpl implements ComplianceResults { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ComplianceResultsImpl.class); + + private final ComplianceResultsClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public ComplianceResultsImpl( + ComplianceResultsClient innerClient, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String scope) { + PagedIterable inner = this.serviceClient().list(scope); + return Utils.mapPage(inner, inner1 -> new ComplianceResultImpl(inner1, this.manager())); + } + + public PagedIterable list(String scope, Context context) { + PagedIterable inner = this.serviceClient().list(scope, context); + return Utils.mapPage(inner, inner1 -> new ComplianceResultImpl(inner1, this.manager())); + } + + public ComplianceResult get(String resourceId, String complianceResultName) { + ComplianceResultInner inner = this.serviceClient().get(resourceId, complianceResultName); + if (inner != null) { + return new ComplianceResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse(String resourceId, String complianceResultName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceId, complianceResultName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ComplianceResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private ComplianceResultsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/CompliancesClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/CompliancesClientImpl.java new file mode 100644 index 000000000000..23383d9810a0 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/CompliancesClientImpl.java @@ -0,0 +1,426 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.CompliancesClient; +import com.azure.resourcemanager.security.fluent.models.ComplianceInner; +import com.azure.resourcemanager.security.models.ComplianceList; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in CompliancesClient. */ +public final class CompliancesClientImpl implements CompliancesClient { + private final ClientLogger logger = new ClientLogger(CompliancesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final CompliancesService service; + + /** The service client containing this operation class. */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of CompliancesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + CompliancesClientImpl(SecurityCenterImpl client) { + this.service = + RestProxy.create(CompliancesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterCompliances to be used by the proxy service to perform + * REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityCenterCompli") + private interface CompliancesService { + @Headers({"Content-Type: application/json"}) + @Get("/{scope}/providers/Microsoft.Security/compliances") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "scope", encoded = true) String scope, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/{scope}/providers/Microsoft.Security/compliances/{complianceName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "scope", encoded = true) String scope, + @PathParam("complianceName") String complianceName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * The Compliance scores of the specific management group. + * + * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Compliance objects response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String scope) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + final String apiVersion = "2017-08-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), apiVersion, scope, accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The Compliance scores of the specific management group. + * + * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Compliance objects response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String scope, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + final String apiVersion = "2017-08-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), apiVersion, scope, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * The Compliance scores of the specific management group. + * + * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Compliance objects response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String scope) { + return new PagedFlux<>(() -> listSinglePageAsync(scope), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * The Compliance scores of the specific management group. + * + * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Compliance objects response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String scope, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(scope, context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * The Compliance scores of the specific management group. + * + * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Compliance objects response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String scope) { + return new PagedIterable<>(listAsync(scope)); + } + + /** + * The Compliance scores of the specific management group. + * + * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Compliance objects response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String scope, Context context) { + return new PagedIterable<>(listAsync(scope, context)); + } + + /** + * Details of a specific Compliance. + * + * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @param complianceName name of the Compliance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return compliance of a scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String scope, String complianceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (complianceName == null) { + return Mono.error(new IllegalArgumentException("Parameter complianceName is required and cannot be null.")); + } + final String apiVersion = "2017-08-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.get(this.client.getEndpoint(), apiVersion, scope, complianceName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Details of a specific Compliance. + * + * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @param complianceName name of the Compliance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return compliance of a scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String scope, String complianceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (complianceName == null) { + return Mono.error(new IllegalArgumentException("Parameter complianceName is required and cannot be null.")); + } + final String apiVersion = "2017-08-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), apiVersion, scope, complianceName, accept, context); + } + + /** + * Details of a specific Compliance. + * + * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @param complianceName name of the Compliance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return compliance of a scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String scope, String complianceName) { + return getWithResponseAsync(scope, complianceName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Details of a specific Compliance. + * + * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @param complianceName name of the Compliance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return compliance of a scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ComplianceInner get(String scope, String complianceName) { + return getAsync(scope, complianceName).block(); + } + + /** + * Details of a specific Compliance. + * + * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @param complianceName name of the Compliance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return compliance of a scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String scope, String complianceName, Context context) { + return getWithResponseAsync(scope, complianceName, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Compliance objects response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Compliance objects response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/CompliancesImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/CompliancesImpl.java new file mode 100644 index 000000000000..4dde94e8edb0 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/CompliancesImpl.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.CompliancesClient; +import com.azure.resourcemanager.security.fluent.models.ComplianceInner; +import com.azure.resourcemanager.security.models.Compliance; +import com.azure.resourcemanager.security.models.Compliances; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class CompliancesImpl implements Compliances { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CompliancesImpl.class); + + private final CompliancesClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public CompliancesImpl( + CompliancesClient innerClient, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String scope) { + PagedIterable inner = this.serviceClient().list(scope); + return Utils.mapPage(inner, inner1 -> new ComplianceImpl(inner1, this.manager())); + } + + public PagedIterable list(String scope, Context context) { + PagedIterable inner = this.serviceClient().list(scope, context); + return Utils.mapPage(inner, inner1 -> new ComplianceImpl(inner1, this.manager())); + } + + public Compliance get(String scope, String complianceName) { + ComplianceInner inner = this.serviceClient().get(scope, complianceName); + if (inner != null) { + return new ComplianceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse(String scope, String complianceName, Context context) { + Response inner = this.serviceClient().getWithResponse(scope, complianceName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ComplianceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private CompliancesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ConnectionStringsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ConnectionStringsImpl.java new file mode 100644 index 000000000000..9014f64c6f6b --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ConnectionStringsImpl.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.resourcemanager.security.fluent.models.ConnectionStringsInner; +import com.azure.resourcemanager.security.models.ConnectionStrings; +import com.azure.resourcemanager.security.models.IngestionConnectionString; +import java.util.Collections; +import java.util.List; + +public final class ConnectionStringsImpl implements ConnectionStrings { + private ConnectionStringsInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + ConnectionStringsImpl( + ConnectionStringsInner innerObject, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public List value() { + List inner = this.innerModel().value(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public ConnectionStringsInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ConnectorSettingImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ConnectorSettingImpl.java new file mode 100644 index 000000000000..8fdafd0a7a49 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ConnectorSettingImpl.java @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.ConnectorSettingInner; +import com.azure.resourcemanager.security.models.AuthenticationDetailsProperties; +import com.azure.resourcemanager.security.models.ConnectorSetting; +import com.azure.resourcemanager.security.models.HybridComputeSettingsProperties; + +public final class ConnectorSettingImpl + implements ConnectorSetting, ConnectorSetting.Definition, ConnectorSetting.Update { + private ConnectorSettingInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public HybridComputeSettingsProperties hybridComputeSettings() { + return this.innerModel().hybridComputeSettings(); + } + + public AuthenticationDetailsProperties authenticationDetails() { + return this.innerModel().authenticationDetails(); + } + + public ConnectorSettingInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } + + private String connectorName; + + public ConnectorSetting create() { + this.innerObject = + serviceManager + .serviceClient() + .getConnectors() + .createOrUpdateWithResponse(connectorName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public ConnectorSetting create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getConnectors() + .createOrUpdateWithResponse(connectorName, this.innerModel(), context) + .getValue(); + return this; + } + + ConnectorSettingImpl(String name, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = new ConnectorSettingInner(); + this.serviceManager = serviceManager; + this.connectorName = name; + } + + public ConnectorSettingImpl update() { + return this; + } + + public ConnectorSetting apply() { + this.innerObject = + serviceManager + .serviceClient() + .getConnectors() + .createOrUpdateWithResponse(connectorName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public ConnectorSetting apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getConnectors() + .createOrUpdateWithResponse(connectorName, this.innerModel(), context) + .getValue(); + return this; + } + + ConnectorSettingImpl( + ConnectorSettingInner innerObject, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.connectorName = Utils.getValueFromIdByName(innerObject.id(), "connectors"); + } + + public ConnectorSetting refresh() { + this.innerObject = + serviceManager.serviceClient().getConnectors().getWithResponse(connectorName, Context.NONE).getValue(); + return this; + } + + public ConnectorSetting refresh(Context context) { + this.innerObject = + serviceManager.serviceClient().getConnectors().getWithResponse(connectorName, context).getValue(); + return this; + } + + public ConnectorSettingImpl withHybridComputeSettings(HybridComputeSettingsProperties hybridComputeSettings) { + this.innerModel().withHybridComputeSettings(hybridComputeSettings); + return this; + } + + public ConnectorSettingImpl withAuthenticationDetails(AuthenticationDetailsProperties authenticationDetails) { + this.innerModel().withAuthenticationDetails(authenticationDetails); + return this; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ConnectorsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ConnectorsClientImpl.java new file mode 100644 index 000000000000..a48fd2db85da --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ConnectorsClientImpl.java @@ -0,0 +1,734 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.ConnectorsClient; +import com.azure.resourcemanager.security.fluent.models.ConnectorSettingInner; +import com.azure.resourcemanager.security.models.ConnectorSettingList; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ConnectorsClient. */ +public final class ConnectorsClientImpl implements ConnectorsClient { + private final ClientLogger logger = new ClientLogger(ConnectorsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ConnectorsService service; + + /** The service client containing this operation class. */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of ConnectorsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ConnectorsClientImpl(SecurityCenterImpl client) { + this.service = + RestProxy.create(ConnectorsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterConnectors to be used by the proxy service to perform + * REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityCenterConnec") + private interface ConnectorsService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/connectors") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/connectors/{connectorName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("connectorName") String connectorName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put("/subscriptions/{subscriptionId}/providers/Microsoft.Security/connectors/{connectorName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("connectorName") String connectorName, + @BodyParam("application/json") ConnectorSettingInner connectorSetting, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete("/subscriptions/{subscriptionId}/providers/Microsoft.Security/connectors/{connectorName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("connectorName") String connectorName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Cloud accounts connectors of a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return for a subscription, list of all cloud account connectors and their settings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-01-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Cloud accounts connectors of a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return for a subscription, list of all cloud account connectors and their settings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-01-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Cloud accounts connectors of a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return for a subscription, list of all cloud account connectors and their settings. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Cloud accounts connectors of a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return for a subscription, list of all cloud account connectors and their settings. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Cloud accounts connectors of a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return for a subscription, list of all cloud account connectors and their settings. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Cloud accounts connectors of a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return for a subscription, list of all cloud account connectors and their settings. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Details of a specific cloud account connector. + * + * @param connectorName Name of the cloud account connector. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the connector setting. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String connectorName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (connectorName == null) { + return Mono.error(new IllegalArgumentException("Parameter connectorName is required and cannot be null.")); + } + final String apiVersion = "2020-01-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + connectorName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Details of a specific cloud account connector. + * + * @param connectorName Name of the cloud account connector. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the connector setting. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String connectorName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (connectorName == null) { + return Mono.error(new IllegalArgumentException("Parameter connectorName is required and cannot be null.")); + } + final String apiVersion = "2020-01-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), connectorName, accept, context); + } + + /** + * Details of a specific cloud account connector. + * + * @param connectorName Name of the cloud account connector. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the connector setting. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String connectorName) { + return getWithResponseAsync(connectorName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Details of a specific cloud account connector. + * + * @param connectorName Name of the cloud account connector. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the connector setting. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ConnectorSettingInner get(String connectorName) { + return getAsync(connectorName).block(); + } + + /** + * Details of a specific cloud account connector. + * + * @param connectorName Name of the cloud account connector. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the connector setting. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String connectorName, Context context) { + return getWithResponseAsync(connectorName, context).block(); + } + + /** + * Create a cloud account connector or update an existing one. Connect to your cloud account. For AWS, use either + * account credentials or role-based authentication. For GCP, use account organization credentials. + * + * @param connectorName Name of the cloud account connector. + * @param connectorSetting Settings for the cloud account connector. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the connector setting. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String connectorName, ConnectorSettingInner connectorSetting) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (connectorName == null) { + return Mono.error(new IllegalArgumentException("Parameter connectorName is required and cannot be null.")); + } + if (connectorSetting == null) { + return Mono + .error(new IllegalArgumentException("Parameter connectorSetting is required and cannot be null.")); + } else { + connectorSetting.validate(); + } + final String apiVersion = "2020-01-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + connectorName, + connectorSetting, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create a cloud account connector or update an existing one. Connect to your cloud account. For AWS, use either + * account credentials or role-based authentication. For GCP, use account organization credentials. + * + * @param connectorName Name of the cloud account connector. + * @param connectorSetting Settings for the cloud account connector. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the connector setting. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String connectorName, ConnectorSettingInner connectorSetting, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (connectorName == null) { + return Mono.error(new IllegalArgumentException("Parameter connectorName is required and cannot be null.")); + } + if (connectorSetting == null) { + return Mono + .error(new IllegalArgumentException("Parameter connectorSetting is required and cannot be null.")); + } else { + connectorSetting.validate(); + } + final String apiVersion = "2020-01-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + connectorName, + connectorSetting, + accept, + context); + } + + /** + * Create a cloud account connector or update an existing one. Connect to your cloud account. For AWS, use either + * account credentials or role-based authentication. For GCP, use account organization credentials. + * + * @param connectorName Name of the cloud account connector. + * @param connectorSetting Settings for the cloud account connector. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the connector setting. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String connectorName, ConnectorSettingInner connectorSetting) { + return createOrUpdateWithResponseAsync(connectorName, connectorSetting) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Create a cloud account connector or update an existing one. Connect to your cloud account. For AWS, use either + * account credentials or role-based authentication. For GCP, use account organization credentials. + * + * @param connectorName Name of the cloud account connector. + * @param connectorSetting Settings for the cloud account connector. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the connector setting. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ConnectorSettingInner createOrUpdate(String connectorName, ConnectorSettingInner connectorSetting) { + return createOrUpdateAsync(connectorName, connectorSetting).block(); + } + + /** + * Create a cloud account connector or update an existing one. Connect to your cloud account. For AWS, use either + * account credentials or role-based authentication. For GCP, use account organization credentials. + * + * @param connectorName Name of the cloud account connector. + * @param connectorSetting Settings for the cloud account connector. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the connector setting. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String connectorName, ConnectorSettingInner connectorSetting, Context context) { + return createOrUpdateWithResponseAsync(connectorName, connectorSetting, context).block(); + } + + /** + * Delete a cloud account connector from a subscription. + * + * @param connectorName Name of the cloud account connector. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String connectorName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (connectorName == null) { + return Mono.error(new IllegalArgumentException("Parameter connectorName is required and cannot be null.")); + } + final String apiVersion = "2020-01-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + connectorName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a cloud account connector from a subscription. + * + * @param connectorName Name of the cloud account connector. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String connectorName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (connectorName == null) { + return Mono.error(new IllegalArgumentException("Parameter connectorName is required and cannot be null.")); + } + final String apiVersion = "2020-01-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), connectorName, accept, context); + } + + /** + * Delete a cloud account connector from a subscription. + * + * @param connectorName Name of the cloud account connector. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String connectorName) { + return deleteWithResponseAsync(connectorName).flatMap((Response res) -> Mono.empty()); + } + + /** + * Delete a cloud account connector from a subscription. + * + * @param connectorName Name of the cloud account connector. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String connectorName) { + deleteAsync(connectorName).block(); + } + + /** + * Delete a cloud account connector from a subscription. + * + * @param connectorName Name of the cloud account connector. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String connectorName, Context context) { + return deleteWithResponseAsync(connectorName, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return for a subscription, list of all cloud account connectors and their settings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return for a subscription, list of all cloud account connectors and their settings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ConnectorsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ConnectorsImpl.java new file mode 100644 index 000000000000..7b383760df4b --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ConnectorsImpl.java @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.ConnectorsClient; +import com.azure.resourcemanager.security.fluent.models.ConnectorSettingInner; +import com.azure.resourcemanager.security.models.ConnectorSetting; +import com.azure.resourcemanager.security.models.Connectors; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ConnectorsImpl implements Connectors { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ConnectorsImpl.class); + + private final ConnectorsClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public ConnectorsImpl( + ConnectorsClient innerClient, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new ConnectorSettingImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new ConnectorSettingImpl(inner1, this.manager())); + } + + public ConnectorSetting get(String connectorName) { + ConnectorSettingInner inner = this.serviceClient().get(connectorName); + if (inner != null) { + return new ConnectorSettingImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse(String connectorName, Context context) { + Response inner = this.serviceClient().getWithResponse(connectorName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ConnectorSettingImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String connectorName) { + this.serviceClient().delete(connectorName); + } + + public Response deleteWithResponse(String connectorName, Context context) { + return this.serviceClient().deleteWithResponse(connectorName, context); + } + + public ConnectorSetting getById(String id) { + String connectorName = Utils.getValueFromIdByName(id, "connectors"); + if (connectorName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'connectors'.", id))); + } + return this.getWithResponse(connectorName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String connectorName = Utils.getValueFromIdByName(id, "connectors"); + if (connectorName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'connectors'.", id))); + } + return this.getWithResponse(connectorName, context); + } + + public void deleteById(String id) { + String connectorName = Utils.getValueFromIdByName(id, "connectors"); + if (connectorName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'connectors'.", id))); + } + this.deleteWithResponse(connectorName, Context.NONE).getValue(); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String connectorName = Utils.getValueFromIdByName(id, "connectors"); + if (connectorName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'connectors'.", id))); + } + return this.deleteWithResponse(connectorName, context); + } + + private ConnectorsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } + + public ConnectorSettingImpl define(String name) { + return new ConnectorSettingImpl(name, this.manager()); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DeviceImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DeviceImpl.java new file mode 100644 index 000000000000..bd7d057a552e --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DeviceImpl.java @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.resourcemanager.security.fluent.models.DeviceInner; +import com.azure.resourcemanager.security.models.AuthorizationState; +import com.azure.resourcemanager.security.models.Device; +import com.azure.resourcemanager.security.models.DeviceCriticality; +import com.azure.resourcemanager.security.models.DeviceStatus; +import com.azure.resourcemanager.security.models.Firmware; +import com.azure.resourcemanager.security.models.ManagementState; +import com.azure.resourcemanager.security.models.NetworkInterface; +import com.azure.resourcemanager.security.models.ProgrammingState; +import com.azure.resourcemanager.security.models.Protocol; +import com.azure.resourcemanager.security.models.PurdueLevel; +import com.azure.resourcemanager.security.models.ScanningFunctionality; +import com.azure.resourcemanager.security.models.Sensor; +import com.azure.resourcemanager.security.models.Site; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; + +public final class DeviceImpl implements Device { + private DeviceInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + DeviceImpl(DeviceInner innerObject, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String displayName() { + return this.innerModel().displayName(); + } + + public String deviceType() { + return this.innerModel().deviceType(); + } + + public String sourceName() { + return this.innerModel().sourceName(); + } + + public List networkInterfaces() { + List inner = this.innerModel().networkInterfaces(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public String vendor() { + return this.innerModel().vendor(); + } + + public String osName() { + return this.innerModel().osName(); + } + + public List protocols() { + List inner = this.innerModel().protocols(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public OffsetDateTime lastActiveTime() { + return this.innerModel().lastActiveTime(); + } + + public OffsetDateTime lastUpdateTime() { + return this.innerModel().lastUpdateTime(); + } + + public ManagementState managementState() { + return this.innerModel().managementState(); + } + + public AuthorizationState authorizationState() { + return this.innerModel().authorizationState(); + } + + public DeviceCriticality deviceCriticality() { + return this.innerModel().deviceCriticality(); + } + + public PurdueLevel purdueLevel() { + return this.innerModel().purdueLevel(); + } + + public String notes() { + return this.innerModel().notes(); + } + + public List firmwares() { + List inner = this.innerModel().firmwares(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public OffsetDateTime discoveryTime() { + return this.innerModel().discoveryTime(); + } + + public ProgrammingState programmingState() { + return this.innerModel().programmingState(); + } + + public OffsetDateTime lastProgrammingTime() { + return this.innerModel().lastProgrammingTime(); + } + + public ScanningFunctionality scanningFunctionality() { + return this.innerModel().scanningFunctionality(); + } + + public OffsetDateTime lastScanTime() { + return this.innerModel().lastScanTime(); + } + + public Integer riskScore() { + return this.innerModel().riskScore(); + } + + public List sensors() { + List inner = this.innerModel().sensors(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public Site site() { + return this.innerModel().site(); + } + + public DeviceStatus deviceStatus() { + return this.innerModel().deviceStatus(); + } + + public DeviceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DeviceSecurityGroupImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DeviceSecurityGroupImpl.java new file mode 100644 index 000000000000..6edb2fe0dd31 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DeviceSecurityGroupImpl.java @@ -0,0 +1,195 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.DeviceSecurityGroupInner; +import com.azure.resourcemanager.security.models.AllowlistCustomAlertRule; +import com.azure.resourcemanager.security.models.DenylistCustomAlertRule; +import com.azure.resourcemanager.security.models.DeviceSecurityGroup; +import com.azure.resourcemanager.security.models.ThresholdCustomAlertRule; +import com.azure.resourcemanager.security.models.TimeWindowCustomAlertRule; +import java.util.Collections; +import java.util.List; + +public final class DeviceSecurityGroupImpl + implements DeviceSecurityGroup, DeviceSecurityGroup.Definition, DeviceSecurityGroup.Update { + private DeviceSecurityGroupInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public List thresholdRules() { + List inner = this.innerModel().thresholdRules(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List timeWindowRules() { + List inner = this.innerModel().timeWindowRules(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List allowlistRules() { + List inner = this.innerModel().allowlistRules(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List denylistRules() { + List inner = this.innerModel().denylistRules(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public DeviceSecurityGroupInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } + + private String resourceId; + + private String deviceSecurityGroupName; + + public DeviceSecurityGroupImpl withExistingResourceId(String resourceId) { + this.resourceId = resourceId; + return this; + } + + public DeviceSecurityGroup create() { + this.innerObject = + serviceManager + .serviceClient() + .getDeviceSecurityGroups() + .createOrUpdateWithResponse(resourceId, deviceSecurityGroupName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public DeviceSecurityGroup create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDeviceSecurityGroups() + .createOrUpdateWithResponse(resourceId, deviceSecurityGroupName, this.innerModel(), context) + .getValue(); + return this; + } + + DeviceSecurityGroupImpl(String name, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = new DeviceSecurityGroupInner(); + this.serviceManager = serviceManager; + this.deviceSecurityGroupName = name; + } + + public DeviceSecurityGroupImpl update() { + return this; + } + + public DeviceSecurityGroup apply() { + this.innerObject = + serviceManager + .serviceClient() + .getDeviceSecurityGroups() + .createOrUpdateWithResponse(resourceId, deviceSecurityGroupName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public DeviceSecurityGroup apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDeviceSecurityGroups() + .createOrUpdateWithResponse(resourceId, deviceSecurityGroupName, this.innerModel(), context) + .getValue(); + return this; + } + + DeviceSecurityGroupImpl( + DeviceSecurityGroupInner innerObject, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceId = + Utils + .getValueFromIdByParameterName( + innerObject.id(), + "/{resourceId}/providers/Microsoft.Security/deviceSecurityGroups/{deviceSecurityGroupName}", + "resourceId"); + this.deviceSecurityGroupName = + Utils + .getValueFromIdByParameterName( + innerObject.id(), + "/{resourceId}/providers/Microsoft.Security/deviceSecurityGroups/{deviceSecurityGroupName}", + "deviceSecurityGroupName"); + } + + public DeviceSecurityGroup refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getDeviceSecurityGroups() + .getWithResponse(resourceId, deviceSecurityGroupName, Context.NONE) + .getValue(); + return this; + } + + public DeviceSecurityGroup refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDeviceSecurityGroups() + .getWithResponse(resourceId, deviceSecurityGroupName, context) + .getValue(); + return this; + } + + public DeviceSecurityGroupImpl withThresholdRules(List thresholdRules) { + this.innerModel().withThresholdRules(thresholdRules); + return this; + } + + public DeviceSecurityGroupImpl withTimeWindowRules(List timeWindowRules) { + this.innerModel().withTimeWindowRules(timeWindowRules); + return this; + } + + public DeviceSecurityGroupImpl withAllowlistRules(List allowlistRules) { + this.innerModel().withAllowlistRules(allowlistRules); + return this; + } + + public DeviceSecurityGroupImpl withDenylistRules(List denylistRules) { + this.innerModel().withDenylistRules(denylistRules); + return this; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DeviceSecurityGroupsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DeviceSecurityGroupsClientImpl.java new file mode 100644 index 000000000000..82a224a5290e --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DeviceSecurityGroupsClientImpl.java @@ -0,0 +1,764 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.DeviceSecurityGroupsClient; +import com.azure.resourcemanager.security.fluent.models.DeviceSecurityGroupInner; +import com.azure.resourcemanager.security.models.DeviceSecurityGroupList; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in DeviceSecurityGroupsClient. */ +public final class DeviceSecurityGroupsClientImpl implements DeviceSecurityGroupsClient { + private final ClientLogger logger = new ClientLogger(DeviceSecurityGroupsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final DeviceSecurityGroupsService service; + + /** The service client containing this operation class. */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of DeviceSecurityGroupsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DeviceSecurityGroupsClientImpl(SecurityCenterImpl client) { + this.service = + RestProxy + .create(DeviceSecurityGroupsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterDeviceSecurityGroups to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityCenterDevice") + private interface DeviceSecurityGroupsService { + @Headers({"Content-Type: application/json"}) + @Get("/{resourceId}/providers/Microsoft.Security/deviceSecurityGroups") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceId", encoded = true) String resourceId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/{resourceId}/providers/Microsoft.Security/deviceSecurityGroups/{deviceSecurityGroupName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceId", encoded = true) String resourceId, + @PathParam("deviceSecurityGroupName") String deviceSecurityGroupName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put("/{resourceId}/providers/Microsoft.Security/deviceSecurityGroups/{deviceSecurityGroupName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceId", encoded = true) String resourceId, + @PathParam("deviceSecurityGroupName") String deviceSecurityGroupName, + @BodyParam("application/json") DeviceSecurityGroupInner deviceSecurityGroup, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete("/{resourceId}/providers/Microsoft.Security/deviceSecurityGroups/{deviceSecurityGroupName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceId", encoded = true) String resourceId, + @PathParam("deviceSecurityGroupName") String deviceSecurityGroupName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Use this method get the list of device security groups for the specified IoT Hub resource. + * + * @param resourceId The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of device security groups. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceId == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); + } + final String apiVersion = "2019-08-01"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), apiVersion, resourceId, accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Use this method get the list of device security groups for the specified IoT Hub resource. + * + * @param resourceId The identifier of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of device security groups. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceId == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); + } + final String apiVersion = "2019-08-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), apiVersion, resourceId, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Use this method get the list of device security groups for the specified IoT Hub resource. + * + * @param resourceId The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of device security groups. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceId) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceId), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Use this method get the list of device security groups for the specified IoT Hub resource. + * + * @param resourceId The identifier of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of device security groups. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceId, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceId, context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Use this method get the list of device security groups for the specified IoT Hub resource. + * + * @param resourceId The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of device security groups. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceId) { + return new PagedIterable<>(listAsync(resourceId)); + } + + /** + * Use this method get the list of device security groups for the specified IoT Hub resource. + * + * @param resourceId The identifier of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of device security groups. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceId, Context context) { + return new PagedIterable<>(listAsync(resourceId, context)); + } + + /** + * Use this method to get the device security group for the specified IoT Hub resource. + * + * @param resourceId The identifier of the resource. + * @param deviceSecurityGroupName The name of the device security group. Note that the name of the device security + * group is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the device security group resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceId, String deviceSecurityGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceId == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); + } + if (deviceSecurityGroupName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter deviceSecurityGroupName is required and cannot be null.")); + } + final String apiVersion = "2019-08-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + apiVersion, + resourceId, + deviceSecurityGroupName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Use this method to get the device security group for the specified IoT Hub resource. + * + * @param resourceId The identifier of the resource. + * @param deviceSecurityGroupName The name of the device security group. Note that the name of the device security + * group is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the device security group resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceId, String deviceSecurityGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceId == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); + } + if (deviceSecurityGroupName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter deviceSecurityGroupName is required and cannot be null.")); + } + final String apiVersion = "2019-08-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), apiVersion, resourceId, deviceSecurityGroupName, accept, context); + } + + /** + * Use this method to get the device security group for the specified IoT Hub resource. + * + * @param resourceId The identifier of the resource. + * @param deviceSecurityGroupName The name of the device security group. Note that the name of the device security + * group is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the device security group resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceId, String deviceSecurityGroupName) { + return getWithResponseAsync(resourceId, deviceSecurityGroupName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Use this method to get the device security group for the specified IoT Hub resource. + * + * @param resourceId The identifier of the resource. + * @param deviceSecurityGroupName The name of the device security group. Note that the name of the device security + * group is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the device security group resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DeviceSecurityGroupInner get(String resourceId, String deviceSecurityGroupName) { + return getAsync(resourceId, deviceSecurityGroupName).block(); + } + + /** + * Use this method to get the device security group for the specified IoT Hub resource. + * + * @param resourceId The identifier of the resource. + * @param deviceSecurityGroupName The name of the device security group. Note that the name of the device security + * group is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the device security group resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceId, String deviceSecurityGroupName, Context context) { + return getWithResponseAsync(resourceId, deviceSecurityGroupName, context).block(); + } + + /** + * Use this method to creates or updates the device security group on a specified IoT Hub resource. + * + * @param resourceId The identifier of the resource. + * @param deviceSecurityGroupName The name of the device security group. Note that the name of the device security + * group is case insensitive. + * @param deviceSecurityGroup Security group object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the device security group resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceId, String deviceSecurityGroupName, DeviceSecurityGroupInner deviceSecurityGroup) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceId == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); + } + if (deviceSecurityGroupName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter deviceSecurityGroupName is required and cannot be null.")); + } + if (deviceSecurityGroup == null) { + return Mono + .error(new IllegalArgumentException("Parameter deviceSecurityGroup is required and cannot be null.")); + } else { + deviceSecurityGroup.validate(); + } + final String apiVersion = "2019-08-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + apiVersion, + resourceId, + deviceSecurityGroupName, + deviceSecurityGroup, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Use this method to creates or updates the device security group on a specified IoT Hub resource. + * + * @param resourceId The identifier of the resource. + * @param deviceSecurityGroupName The name of the device security group. Note that the name of the device security + * group is case insensitive. + * @param deviceSecurityGroup Security group object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the device security group resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceId, + String deviceSecurityGroupName, + DeviceSecurityGroupInner deviceSecurityGroup, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceId == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); + } + if (deviceSecurityGroupName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter deviceSecurityGroupName is required and cannot be null.")); + } + if (deviceSecurityGroup == null) { + return Mono + .error(new IllegalArgumentException("Parameter deviceSecurityGroup is required and cannot be null.")); + } else { + deviceSecurityGroup.validate(); + } + final String apiVersion = "2019-08-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + apiVersion, + resourceId, + deviceSecurityGroupName, + deviceSecurityGroup, + accept, + context); + } + + /** + * Use this method to creates or updates the device security group on a specified IoT Hub resource. + * + * @param resourceId The identifier of the resource. + * @param deviceSecurityGroupName The name of the device security group. Note that the name of the device security + * group is case insensitive. + * @param deviceSecurityGroup Security group object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the device security group resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceId, String deviceSecurityGroupName, DeviceSecurityGroupInner deviceSecurityGroup) { + return createOrUpdateWithResponseAsync(resourceId, deviceSecurityGroupName, deviceSecurityGroup) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Use this method to creates or updates the device security group on a specified IoT Hub resource. + * + * @param resourceId The identifier of the resource. + * @param deviceSecurityGroupName The name of the device security group. Note that the name of the device security + * group is case insensitive. + * @param deviceSecurityGroup Security group object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the device security group resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DeviceSecurityGroupInner createOrUpdate( + String resourceId, String deviceSecurityGroupName, DeviceSecurityGroupInner deviceSecurityGroup) { + return createOrUpdateAsync(resourceId, deviceSecurityGroupName, deviceSecurityGroup).block(); + } + + /** + * Use this method to creates or updates the device security group on a specified IoT Hub resource. + * + * @param resourceId The identifier of the resource. + * @param deviceSecurityGroupName The name of the device security group. Note that the name of the device security + * group is case insensitive. + * @param deviceSecurityGroup Security group object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the device security group resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceId, + String deviceSecurityGroupName, + DeviceSecurityGroupInner deviceSecurityGroup, + Context context) { + return createOrUpdateWithResponseAsync(resourceId, deviceSecurityGroupName, deviceSecurityGroup, context) + .block(); + } + + /** + * User this method to deletes the device security group. + * + * @param resourceId The identifier of the resource. + * @param deviceSecurityGroupName The name of the device security group. Note that the name of the device security + * group is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceId, String deviceSecurityGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceId == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); + } + if (deviceSecurityGroupName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter deviceSecurityGroupName is required and cannot be null.")); + } + final String apiVersion = "2019-08-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + apiVersion, + resourceId, + deviceSecurityGroupName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * User this method to deletes the device security group. + * + * @param resourceId The identifier of the resource. + * @param deviceSecurityGroupName The name of the device security group. Note that the name of the device security + * group is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceId, String deviceSecurityGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceId == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); + } + if (deviceSecurityGroupName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter deviceSecurityGroupName is required and cannot be null.")); + } + final String apiVersion = "2019-08-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete(this.client.getEndpoint(), apiVersion, resourceId, deviceSecurityGroupName, accept, context); + } + + /** + * User this method to deletes the device security group. + * + * @param resourceId The identifier of the resource. + * @param deviceSecurityGroupName The name of the device security group. Note that the name of the device security + * group is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceId, String deviceSecurityGroupName) { + return deleteWithResponseAsync(resourceId, deviceSecurityGroupName) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * User this method to deletes the device security group. + * + * @param resourceId The identifier of the resource. + * @param deviceSecurityGroupName The name of the device security group. Note that the name of the device security + * group is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceId, String deviceSecurityGroupName) { + deleteAsync(resourceId, deviceSecurityGroupName).block(); + } + + /** + * User this method to deletes the device security group. + * + * @param resourceId The identifier of the resource. + * @param deviceSecurityGroupName The name of the device security group. Note that the name of the device security + * group is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String resourceId, String deviceSecurityGroupName, Context context) { + return deleteWithResponseAsync(resourceId, deviceSecurityGroupName, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of device security groups. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of device security groups. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DeviceSecurityGroupsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DeviceSecurityGroupsImpl.java new file mode 100644 index 000000000000..7ef140eaab87 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DeviceSecurityGroupsImpl.java @@ -0,0 +1,208 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.DeviceSecurityGroupsClient; +import com.azure.resourcemanager.security.fluent.models.DeviceSecurityGroupInner; +import com.azure.resourcemanager.security.models.DeviceSecurityGroup; +import com.azure.resourcemanager.security.models.DeviceSecurityGroups; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class DeviceSecurityGroupsImpl implements DeviceSecurityGroups { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DeviceSecurityGroupsImpl.class); + + private final DeviceSecurityGroupsClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public DeviceSecurityGroupsImpl( + DeviceSecurityGroupsClient innerClient, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceId) { + PagedIterable inner = this.serviceClient().list(resourceId); + return Utils.mapPage(inner, inner1 -> new DeviceSecurityGroupImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceId, Context context) { + PagedIterable inner = this.serviceClient().list(resourceId, context); + return Utils.mapPage(inner, inner1 -> new DeviceSecurityGroupImpl(inner1, this.manager())); + } + + public DeviceSecurityGroup get(String resourceId, String deviceSecurityGroupName) { + DeviceSecurityGroupInner inner = this.serviceClient().get(resourceId, deviceSecurityGroupName); + if (inner != null) { + return new DeviceSecurityGroupImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceId, String deviceSecurityGroupName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceId, deviceSecurityGroupName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DeviceSecurityGroupImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceId, String deviceSecurityGroupName) { + this.serviceClient().delete(resourceId, deviceSecurityGroupName); + } + + public Response deleteWithResponse(String resourceId, String deviceSecurityGroupName, Context context) { + return this.serviceClient().deleteWithResponse(resourceId, deviceSecurityGroupName, context); + } + + public DeviceSecurityGroup getById(String id) { + String resourceId = + Utils + .getValueFromIdByParameterName( + id, + "/{resourceId}/providers/Microsoft.Security/deviceSecurityGroups/{deviceSecurityGroupName}", + "resourceId"); + if (resourceId == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceId'.", id))); + } + String deviceSecurityGroupName = + Utils + .getValueFromIdByParameterName( + id, + "/{resourceId}/providers/Microsoft.Security/deviceSecurityGroups/{deviceSecurityGroupName}", + "deviceSecurityGroupName"); + if (deviceSecurityGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'deviceSecurityGroups'.", + id))); + } + return this.getWithResponse(resourceId, deviceSecurityGroupName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceId = + Utils + .getValueFromIdByParameterName( + id, + "/{resourceId}/providers/Microsoft.Security/deviceSecurityGroups/{deviceSecurityGroupName}", + "resourceId"); + if (resourceId == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceId'.", id))); + } + String deviceSecurityGroupName = + Utils + .getValueFromIdByParameterName( + id, + "/{resourceId}/providers/Microsoft.Security/deviceSecurityGroups/{deviceSecurityGroupName}", + "deviceSecurityGroupName"); + if (deviceSecurityGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'deviceSecurityGroups'.", + id))); + } + return this.getWithResponse(resourceId, deviceSecurityGroupName, context); + } + + public void deleteById(String id) { + String resourceId = + Utils + .getValueFromIdByParameterName( + id, + "/{resourceId}/providers/Microsoft.Security/deviceSecurityGroups/{deviceSecurityGroupName}", + "resourceId"); + if (resourceId == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceId'.", id))); + } + String deviceSecurityGroupName = + Utils + .getValueFromIdByParameterName( + id, + "/{resourceId}/providers/Microsoft.Security/deviceSecurityGroups/{deviceSecurityGroupName}", + "deviceSecurityGroupName"); + if (deviceSecurityGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'deviceSecurityGroups'.", + id))); + } + this.deleteWithResponse(resourceId, deviceSecurityGroupName, Context.NONE).getValue(); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceId = + Utils + .getValueFromIdByParameterName( + id, + "/{resourceId}/providers/Microsoft.Security/deviceSecurityGroups/{deviceSecurityGroupName}", + "resourceId"); + if (resourceId == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceId'.", id))); + } + String deviceSecurityGroupName = + Utils + .getValueFromIdByParameterName( + id, + "/{resourceId}/providers/Microsoft.Security/deviceSecurityGroups/{deviceSecurityGroupName}", + "deviceSecurityGroupName"); + if (deviceSecurityGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'deviceSecurityGroups'.", + id))); + } + return this.deleteWithResponse(resourceId, deviceSecurityGroupName, context); + } + + private DeviceSecurityGroupsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } + + public DeviceSecurityGroupImpl define(String name) { + return new DeviceSecurityGroupImpl(name, this.manager()); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DevicesClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DevicesClientImpl.java new file mode 100644 index 000000000000..d34756166cac --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DevicesClientImpl.java @@ -0,0 +1,185 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.DevicesClient; +import com.azure.resourcemanager.security.fluent.models.DeviceInner; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in DevicesClient. */ +public final class DevicesClientImpl implements DevicesClient { + private final ClientLogger logger = new ClientLogger(DevicesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final DevicesService service; + + /** The service client containing this operation class. */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of DevicesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DevicesClientImpl(SecurityCenterImpl client) { + this.service = RestProxy.create(DevicesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterDevices to be used by the proxy service to perform REST + * calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityCenterDevice") + private interface DevicesService { + @Headers({"Content-Type: application/json"}) + @Get("/{resourceId}/providers/Microsoft.Security/devices/{deviceId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceId", encoded = true) String resourceId, + @PathParam("deviceId") String deviceId, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Get device. + * + * @param resourceId The identifier of the resource. + * @param deviceId Identifier of the device. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return device. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceId, String deviceId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceId == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); + } + if (deviceId == null) { + return Mono.error(new IllegalArgumentException("Parameter deviceId is required and cannot be null.")); + } + final String apiVersion = "2020-08-06-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.get(this.client.getEndpoint(), apiVersion, resourceId, deviceId, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get device. + * + * @param resourceId The identifier of the resource. + * @param deviceId Identifier of the device. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return device. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceId, String deviceId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceId == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); + } + if (deviceId == null) { + return Mono.error(new IllegalArgumentException("Parameter deviceId is required and cannot be null.")); + } + final String apiVersion = "2020-08-06-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), apiVersion, resourceId, deviceId, accept, context); + } + + /** + * Get device. + * + * @param resourceId The identifier of the resource. + * @param deviceId Identifier of the device. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return device. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceId, String deviceId) { + return getWithResponseAsync(resourceId, deviceId) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get device. + * + * @param resourceId The identifier of the resource. + * @param deviceId Identifier of the device. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return device. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DeviceInner get(String resourceId, String deviceId) { + return getAsync(resourceId, deviceId).block(); + } + + /** + * Get device. + * + * @param resourceId The identifier of the resource. + * @param deviceId Identifier of the device. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return device. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceId, String deviceId, Context context) { + return getWithResponseAsync(resourceId, deviceId, context).block(); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DevicesForHubsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DevicesForHubsClientImpl.java new file mode 100644 index 000000000000..ddee689ac4ae --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DevicesForHubsClientImpl.java @@ -0,0 +1,354 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.DevicesForHubsClient; +import com.azure.resourcemanager.security.fluent.models.DeviceInner; +import com.azure.resourcemanager.security.models.DeviceList; +import com.azure.resourcemanager.security.models.ManagementState; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in DevicesForHubsClient. */ +public final class DevicesForHubsClientImpl implements DevicesForHubsClient { + private final ClientLogger logger = new ClientLogger(DevicesForHubsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final DevicesForHubsService service; + + /** The service client containing this operation class. */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of DevicesForHubsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DevicesForHubsClientImpl(SecurityCenterImpl client) { + this.service = + RestProxy.create(DevicesForHubsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterDevicesForHubs to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityCenterDevice") + private interface DevicesForHubsService { + @Headers({"Content-Type: application/json"}) + @Get("/{resourceId}/providers/Microsoft.Security/devices") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceId", encoded = true) String resourceId, + @QueryParam("$limit") Integer limit, + @QueryParam("$skipToken") String skipToken, + @QueryParam("deviceManagementType") ManagementState deviceManagementType, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Get list of the devices for the specified IoT Hub resource. + * + * @param resourceId The identifier of the resource. + * @param limit Limit the number of items returned in a single page. + * @param skipToken Skip token used for pagination. + * @param deviceManagementType Get devices only from specific type, Managed or Unmanaged. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of the devices for the specified IoT Hub resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceId, Integer limit, String skipToken, ManagementState deviceManagementType) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceId == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); + } + final String apiVersion = "2020-08-06-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + apiVersion, + resourceId, + limit, + skipToken, + deviceManagementType, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get list of the devices for the specified IoT Hub resource. + * + * @param resourceId The identifier of the resource. + * @param limit Limit the number of items returned in a single page. + * @param skipToken Skip token used for pagination. + * @param deviceManagementType Get devices only from specific type, Managed or Unmanaged. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of the devices for the specified IoT Hub resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceId, Integer limit, String skipToken, ManagementState deviceManagementType, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceId == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); + } + final String apiVersion = "2020-08-06-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + apiVersion, + resourceId, + limit, + skipToken, + deviceManagementType, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get list of the devices for the specified IoT Hub resource. + * + * @param resourceId The identifier of the resource. + * @param limit Limit the number of items returned in a single page. + * @param skipToken Skip token used for pagination. + * @param deviceManagementType Get devices only from specific type, Managed or Unmanaged. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of the devices for the specified IoT Hub resource. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceId, Integer limit, String skipToken, ManagementState deviceManagementType) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceId, limit, skipToken, deviceManagementType), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Get list of the devices for the specified IoT Hub resource. + * + * @param resourceId The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of the devices for the specified IoT Hub resource. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceId) { + final Integer limit = null; + final String skipToken = null; + final ManagementState deviceManagementType = null; + return new PagedFlux<>( + () -> listSinglePageAsync(resourceId, limit, skipToken, deviceManagementType), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Get list of the devices for the specified IoT Hub resource. + * + * @param resourceId The identifier of the resource. + * @param limit Limit the number of items returned in a single page. + * @param skipToken Skip token used for pagination. + * @param deviceManagementType Get devices only from specific type, Managed or Unmanaged. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of the devices for the specified IoT Hub resource. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceId, Integer limit, String skipToken, ManagementState deviceManagementType, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceId, limit, skipToken, deviceManagementType, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Get list of the devices for the specified IoT Hub resource. + * + * @param resourceId The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of the devices for the specified IoT Hub resource. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceId) { + final Integer limit = null; + final String skipToken = null; + final ManagementState deviceManagementType = null; + return new PagedIterable<>(listAsync(resourceId, limit, skipToken, deviceManagementType)); + } + + /** + * Get list of the devices for the specified IoT Hub resource. + * + * @param resourceId The identifier of the resource. + * @param limit Limit the number of items returned in a single page. + * @param skipToken Skip token used for pagination. + * @param deviceManagementType Get devices only from specific type, Managed or Unmanaged. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of the devices for the specified IoT Hub resource. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String resourceId, Integer limit, String skipToken, ManagementState deviceManagementType, Context context) { + return new PagedIterable<>(listAsync(resourceId, limit, skipToken, deviceManagementType, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Devices. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Devices. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DevicesForHubsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DevicesForHubsImpl.java new file mode 100644 index 000000000000..c767b26ae791 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DevicesForHubsImpl.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.DevicesForHubsClient; +import com.azure.resourcemanager.security.fluent.models.DeviceInner; +import com.azure.resourcemanager.security.models.Device; +import com.azure.resourcemanager.security.models.DevicesForHubs; +import com.azure.resourcemanager.security.models.ManagementState; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class DevicesForHubsImpl implements DevicesForHubs { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DevicesForHubsImpl.class); + + private final DevicesForHubsClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public DevicesForHubsImpl( + DevicesForHubsClient innerClient, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceId) { + PagedIterable inner = this.serviceClient().list(resourceId); + return Utils.mapPage(inner, inner1 -> new DeviceImpl(inner1, this.manager())); + } + + public PagedIterable list( + String resourceId, Integer limit, String skipToken, ManagementState deviceManagementType, Context context) { + PagedIterable inner = + this.serviceClient().list(resourceId, limit, skipToken, deviceManagementType, context); + return Utils.mapPage(inner, inner1 -> new DeviceImpl(inner1, this.manager())); + } + + private DevicesForHubsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DevicesForSubscriptionsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DevicesForSubscriptionsClientImpl.java new file mode 100644 index 000000000000..11c37fd3a56d --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DevicesForSubscriptionsClientImpl.java @@ -0,0 +1,351 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.DevicesForSubscriptionsClient; +import com.azure.resourcemanager.security.fluent.models.DeviceInner; +import com.azure.resourcemanager.security.models.DeviceList; +import com.azure.resourcemanager.security.models.ManagementState; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in DevicesForSubscriptionsClient. */ +public final class DevicesForSubscriptionsClientImpl implements DevicesForSubscriptionsClient { + private final ClientLogger logger = new ClientLogger(DevicesForSubscriptionsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final DevicesForSubscriptionsService service; + + /** The service client containing this operation class. */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of DevicesForSubscriptionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DevicesForSubscriptionsClientImpl(SecurityCenterImpl client) { + this.service = + RestProxy + .create(DevicesForSubscriptionsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterDevicesForSubscriptions to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityCenterDevice") + private interface DevicesForSubscriptionsService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/devices") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("$limit") Integer limit, + @QueryParam("$skipToken") String skipToken, + @QueryParam("deviceManagementType") ManagementState deviceManagementType, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Get list of the devices by their subscription. + * + * @param limit Limit the number of items returned in a single page. + * @param skipToken Skip token used for pagination. + * @param deviceManagementType Get devices only from specific type, Managed or Unmanaged. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of the devices by their subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + Integer limit, String skipToken, ManagementState deviceManagementType) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-08-06-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + limit, + skipToken, + deviceManagementType, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get list of the devices by their subscription. + * + * @param limit Limit the number of items returned in a single page. + * @param skipToken Skip token used for pagination. + * @param deviceManagementType Get devices only from specific type, Managed or Unmanaged. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of the devices by their subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + Integer limit, String skipToken, ManagementState deviceManagementType, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-08-06-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + limit, + skipToken, + deviceManagementType, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get list of the devices by their subscription. + * + * @param limit Limit the number of items returned in a single page. + * @param skipToken Skip token used for pagination. + * @param deviceManagementType Get devices only from specific type, Managed or Unmanaged. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of the devices by their subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Integer limit, String skipToken, ManagementState deviceManagementType) { + return new PagedFlux<>( + () -> listSinglePageAsync(limit, skipToken, deviceManagementType), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Get list of the devices by their subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of the devices by their subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + final Integer limit = null; + final String skipToken = null; + final ManagementState deviceManagementType = null; + return new PagedFlux<>( + () -> listSinglePageAsync(limit, skipToken, deviceManagementType), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Get list of the devices by their subscription. + * + * @param limit Limit the number of items returned in a single page. + * @param skipToken Skip token used for pagination. + * @param deviceManagementType Get devices only from specific type, Managed or Unmanaged. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of the devices by their subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + Integer limit, String skipToken, ManagementState deviceManagementType, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(limit, skipToken, deviceManagementType, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Get list of the devices by their subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of the devices by their subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + final Integer limit = null; + final String skipToken = null; + final ManagementState deviceManagementType = null; + return new PagedIterable<>(listAsync(limit, skipToken, deviceManagementType)); + } + + /** + * Get list of the devices by their subscription. + * + * @param limit Limit the number of items returned in a single page. + * @param skipToken Skip token used for pagination. + * @param deviceManagementType Get devices only from specific type, Managed or Unmanaged. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of the devices by their subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + Integer limit, String skipToken, ManagementState deviceManagementType, Context context) { + return new PagedIterable<>(listAsync(limit, skipToken, deviceManagementType, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Devices. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Devices. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DevicesForSubscriptionsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DevicesForSubscriptionsImpl.java new file mode 100644 index 000000000000..8bf12d31599f --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DevicesForSubscriptionsImpl.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.DevicesForSubscriptionsClient; +import com.azure.resourcemanager.security.fluent.models.DeviceInner; +import com.azure.resourcemanager.security.models.Device; +import com.azure.resourcemanager.security.models.DevicesForSubscriptions; +import com.azure.resourcemanager.security.models.ManagementState; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class DevicesForSubscriptionsImpl implements DevicesForSubscriptions { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DevicesForSubscriptionsImpl.class); + + private final DevicesForSubscriptionsClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public DevicesForSubscriptionsImpl( + DevicesForSubscriptionsClient innerClient, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new DeviceImpl(inner1, this.manager())); + } + + public PagedIterable list( + Integer limit, String skipToken, ManagementState deviceManagementType, Context context) { + PagedIterable inner = this.serviceClient().list(limit, skipToken, deviceManagementType, context); + return Utils.mapPage(inner, inner1 -> new DeviceImpl(inner1, this.manager())); + } + + private DevicesForSubscriptionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DevicesImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DevicesImpl.java new file mode 100644 index 000000000000..f3391fbd664d --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DevicesImpl.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.DevicesClient; +import com.azure.resourcemanager.security.fluent.models.DeviceInner; +import com.azure.resourcemanager.security.models.Device; +import com.azure.resourcemanager.security.models.Devices; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class DevicesImpl implements Devices { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DevicesImpl.class); + + private final DevicesClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public DevicesImpl(DevicesClient innerClient, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Device get(String resourceId, String deviceId) { + DeviceInner inner = this.serviceClient().get(resourceId, deviceId); + if (inner != null) { + return new DeviceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse(String resourceId, String deviceId, Context context) { + Response inner = this.serviceClient().getWithResponse(resourceId, deviceId, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DeviceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private DevicesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DiscoveredSecuritySolutionImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DiscoveredSecuritySolutionImpl.java new file mode 100644 index 000000000000..9f8c13cde556 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DiscoveredSecuritySolutionImpl.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.resourcemanager.security.fluent.models.DiscoveredSecuritySolutionInner; +import com.azure.resourcemanager.security.models.DiscoveredSecuritySolution; +import com.azure.resourcemanager.security.models.SecurityFamily; + +public final class DiscoveredSecuritySolutionImpl implements DiscoveredSecuritySolution { + private DiscoveredSecuritySolutionInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + DiscoveredSecuritySolutionImpl( + DiscoveredSecuritySolutionInner innerObject, + com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public SecurityFamily securityFamily() { + return this.innerModel().securityFamily(); + } + + public String offer() { + return this.innerModel().offer(); + } + + public String publisher() { + return this.innerModel().publisher(); + } + + public String sku() { + return this.innerModel().sku(); + } + + public String location() { + return this.innerModel().location(); + } + + public DiscoveredSecuritySolutionInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DiscoveredSecuritySolutionsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DiscoveredSecuritySolutionsClientImpl.java new file mode 100644 index 000000000000..3a41c90c706f --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DiscoveredSecuritySolutionsClientImpl.java @@ -0,0 +1,747 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.DiscoveredSecuritySolutionsClient; +import com.azure.resourcemanager.security.fluent.models.DiscoveredSecuritySolutionInner; +import com.azure.resourcemanager.security.models.DiscoveredSecuritySolutionList; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in DiscoveredSecuritySolutionsClient. */ +public final class DiscoveredSecuritySolutionsClientImpl implements DiscoveredSecuritySolutionsClient { + private final ClientLogger logger = new ClientLogger(DiscoveredSecuritySolutionsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final DiscoveredSecuritySolutionsService service; + + /** The service client containing this operation class. */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of DiscoveredSecuritySolutionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DiscoveredSecuritySolutionsClientImpl(SecurityCenterImpl client) { + this.service = + RestProxy + .create( + DiscoveredSecuritySolutionsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterDiscoveredSecuritySolutions to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityCenterDiscov") + private interface DiscoveredSecuritySolutionsService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/discoveredSecuritySolutions") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}" + + "/discoveredSecuritySolutions") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByHomeRegion( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("ascLocation") String ascLocation, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations" + + "/{ascLocation}/discoveredSecuritySolutions/{discoveredSecuritySolutionName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("ascLocation") String ascLocation, + @PathParam("discoveredSecuritySolutionName") String discoveredSecuritySolutionName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByHomeRegionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a list of discovered Security Solutions for the subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of discovered Security Solutions for the subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list(this.client.getEndpoint(), this.client.getSubscriptionId(), apiVersion, accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of discovered Security Solutions for the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of discovered Security Solutions for the subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getSubscriptionId(), apiVersion, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a list of discovered Security Solutions for the subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of discovered Security Solutions for the subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of discovered Security Solutions for the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of discovered Security Solutions for the subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list of discovered Security Solutions for the subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of discovered Security Solutions for the subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Gets a list of discovered Security Solutions for the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of discovered Security Solutions for the subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Gets a list of discovered Security Solutions for the subscription and location. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of discovered Security Solutions for the subscription and location. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByHomeRegionSinglePageAsync(String ascLocation) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (ascLocation == null) { + return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByHomeRegion( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + ascLocation, + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of discovered Security Solutions for the subscription and location. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of discovered Security Solutions for the subscription and location. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByHomeRegionSinglePageAsync( + String ascLocation, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (ascLocation == null) { + return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByHomeRegion( + this.client.getEndpoint(), this.client.getSubscriptionId(), ascLocation, apiVersion, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a list of discovered Security Solutions for the subscription and location. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of discovered Security Solutions for the subscription and location. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByHomeRegionAsync(String ascLocation) { + return new PagedFlux<>( + () -> listByHomeRegionSinglePageAsync(ascLocation), + nextLink -> listByHomeRegionNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of discovered Security Solutions for the subscription and location. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of discovered Security Solutions for the subscription and location. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByHomeRegionAsync(String ascLocation, Context context) { + return new PagedFlux<>( + () -> listByHomeRegionSinglePageAsync(ascLocation, context), + nextLink -> listByHomeRegionNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list of discovered Security Solutions for the subscription and location. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of discovered Security Solutions for the subscription and location. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByHomeRegion(String ascLocation) { + return new PagedIterable<>(listByHomeRegionAsync(ascLocation)); + } + + /** + * Gets a list of discovered Security Solutions for the subscription and location. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of discovered Security Solutions for the subscription and location. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByHomeRegion(String ascLocation, Context context) { + return new PagedIterable<>(listByHomeRegionAsync(ascLocation, context)); + } + + /** + * Gets a specific discovered Security Solution. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param discoveredSecuritySolutionName Name of a discovered security solution. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a specific discovered Security Solution. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String ascLocation, String discoveredSecuritySolutionName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (ascLocation == null) { + return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + if (discoveredSecuritySolutionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter discoveredSecuritySolutionName is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + ascLocation, + discoveredSecuritySolutionName, + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a specific discovered Security Solution. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param discoveredSecuritySolutionName Name of a discovered security solution. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a specific discovered Security Solution. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String ascLocation, String discoveredSecuritySolutionName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (ascLocation == null) { + return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + if (discoveredSecuritySolutionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter discoveredSecuritySolutionName is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + ascLocation, + discoveredSecuritySolutionName, + apiVersion, + accept, + context); + } + + /** + * Gets a specific discovered Security Solution. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param discoveredSecuritySolutionName Name of a discovered security solution. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a specific discovered Security Solution. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String ascLocation, String discoveredSecuritySolutionName) { + return getWithResponseAsync(resourceGroupName, ascLocation, discoveredSecuritySolutionName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a specific discovered Security Solution. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param discoveredSecuritySolutionName Name of a discovered security solution. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a specific discovered Security Solution. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DiscoveredSecuritySolutionInner get( + String resourceGroupName, String ascLocation, String discoveredSecuritySolutionName) { + return getAsync(resourceGroupName, ascLocation, discoveredSecuritySolutionName).block(); + } + + /** + * Gets a specific discovered Security Solution. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param discoveredSecuritySolutionName Name of a discovered security solution. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a specific discovered Security Solution. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String ascLocation, String discoveredSecuritySolutionName, Context context) { + return getWithResponseAsync(resourceGroupName, ascLocation, discoveredSecuritySolutionName, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByHomeRegionNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByHomeRegionNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByHomeRegionNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByHomeRegionNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DiscoveredSecuritySolutionsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DiscoveredSecuritySolutionsImpl.java new file mode 100644 index 000000000000..84fe405d0236 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DiscoveredSecuritySolutionsImpl.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.DiscoveredSecuritySolutionsClient; +import com.azure.resourcemanager.security.fluent.models.DiscoveredSecuritySolutionInner; +import com.azure.resourcemanager.security.models.DiscoveredSecuritySolution; +import com.azure.resourcemanager.security.models.DiscoveredSecuritySolutions; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class DiscoveredSecuritySolutionsImpl implements DiscoveredSecuritySolutions { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DiscoveredSecuritySolutionsImpl.class); + + private final DiscoveredSecuritySolutionsClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public DiscoveredSecuritySolutionsImpl( + DiscoveredSecuritySolutionsClient innerClient, + com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new DiscoveredSecuritySolutionImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new DiscoveredSecuritySolutionImpl(inner1, this.manager())); + } + + public PagedIterable listByHomeRegion(String ascLocation) { + PagedIterable inner = this.serviceClient().listByHomeRegion(ascLocation); + return Utils.mapPage(inner, inner1 -> new DiscoveredSecuritySolutionImpl(inner1, this.manager())); + } + + public PagedIterable listByHomeRegion(String ascLocation, Context context) { + PagedIterable inner = + this.serviceClient().listByHomeRegion(ascLocation, context); + return Utils.mapPage(inner, inner1 -> new DiscoveredSecuritySolutionImpl(inner1, this.manager())); + } + + public DiscoveredSecuritySolution get( + String resourceGroupName, String ascLocation, String discoveredSecuritySolutionName) { + DiscoveredSecuritySolutionInner inner = + this.serviceClient().get(resourceGroupName, ascLocation, discoveredSecuritySolutionName); + if (inner != null) { + return new DiscoveredSecuritySolutionImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String ascLocation, String discoveredSecuritySolutionName, Context context) { + Response inner = + this + .serviceClient() + .getWithResponse(resourceGroupName, ascLocation, discoveredSecuritySolutionName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DiscoveredSecuritySolutionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private DiscoveredSecuritySolutionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ExternalSecuritySolutionImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ExternalSecuritySolutionImpl.java new file mode 100644 index 000000000000..aca3c0f73e30 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ExternalSecuritySolutionImpl.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.resourcemanager.security.fluent.models.ExternalSecuritySolutionInner; +import com.azure.resourcemanager.security.models.ExternalSecuritySolution; + +public final class ExternalSecuritySolutionImpl implements ExternalSecuritySolution { + private ExternalSecuritySolutionInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + ExternalSecuritySolutionImpl( + ExternalSecuritySolutionInner innerObject, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public ExternalSecuritySolutionInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ExternalSecuritySolutionsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ExternalSecuritySolutionsClientImpl.java new file mode 100644 index 000000000000..72e11f6f5497 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ExternalSecuritySolutionsClientImpl.java @@ -0,0 +1,747 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.ExternalSecuritySolutionsClient; +import com.azure.resourcemanager.security.fluent.models.ExternalSecuritySolutionInner; +import com.azure.resourcemanager.security.models.ExternalSecuritySolutionList; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ExternalSecuritySolutionsClient. */ +public final class ExternalSecuritySolutionsClientImpl implements ExternalSecuritySolutionsClient { + private final ClientLogger logger = new ClientLogger(ExternalSecuritySolutionsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ExternalSecuritySolutionsService service; + + /** The service client containing this operation class. */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of ExternalSecuritySolutionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ExternalSecuritySolutionsClientImpl(SecurityCenterImpl client) { + this.service = + RestProxy + .create( + ExternalSecuritySolutionsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterExternalSecuritySolutions to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityCenterExtern") + private interface ExternalSecuritySolutionsService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/externalSecuritySolutions") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}" + + "/ExternalSecuritySolutions") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByHomeRegion( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("ascLocation") String ascLocation, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations" + + "/{ascLocation}/ExternalSecuritySolutions/{externalSecuritySolutionsName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("ascLocation") String ascLocation, + @PathParam("externalSecuritySolutionsName") String externalSecuritySolutionsName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByHomeRegionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a list of external security solutions for the subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of external security solutions for the subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of external security solutions for the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of external security solutions for the subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a list of external security solutions for the subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of external security solutions for the subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of external security solutions for the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of external security solutions for the subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list of external security solutions for the subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of external security solutions for the subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Gets a list of external security solutions for the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of external security solutions for the subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Gets a list of external Security Solutions for the subscription and location. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of external Security Solutions for the subscription and location. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByHomeRegionSinglePageAsync(String ascLocation) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (ascLocation == null) { + return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByHomeRegion( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + ascLocation, + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of external Security Solutions for the subscription and location. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of external Security Solutions for the subscription and location. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByHomeRegionSinglePageAsync( + String ascLocation, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (ascLocation == null) { + return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByHomeRegion( + this.client.getEndpoint(), this.client.getSubscriptionId(), ascLocation, apiVersion, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a list of external Security Solutions for the subscription and location. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of external Security Solutions for the subscription and location. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByHomeRegionAsync(String ascLocation) { + return new PagedFlux<>( + () -> listByHomeRegionSinglePageAsync(ascLocation), + nextLink -> listByHomeRegionNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of external Security Solutions for the subscription and location. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of external Security Solutions for the subscription and location. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByHomeRegionAsync(String ascLocation, Context context) { + return new PagedFlux<>( + () -> listByHomeRegionSinglePageAsync(ascLocation, context), + nextLink -> listByHomeRegionNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list of external Security Solutions for the subscription and location. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of external Security Solutions for the subscription and location. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByHomeRegion(String ascLocation) { + return new PagedIterable<>(listByHomeRegionAsync(ascLocation)); + } + + /** + * Gets a list of external Security Solutions for the subscription and location. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of external Security Solutions for the subscription and location. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByHomeRegion(String ascLocation, Context context) { + return new PagedIterable<>(listByHomeRegionAsync(ascLocation, context)); + } + + /** + * Gets a specific external Security Solution. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param externalSecuritySolutionsName Name of an external security solution. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a specific external Security Solution. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String ascLocation, String externalSecuritySolutionsName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (ascLocation == null) { + return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + if (externalSecuritySolutionsName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter externalSecuritySolutionsName is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + ascLocation, + externalSecuritySolutionsName, + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a specific external Security Solution. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param externalSecuritySolutionsName Name of an external security solution. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a specific external Security Solution. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String ascLocation, String externalSecuritySolutionsName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (ascLocation == null) { + return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + if (externalSecuritySolutionsName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter externalSecuritySolutionsName is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + ascLocation, + externalSecuritySolutionsName, + apiVersion, + accept, + context); + } + + /** + * Gets a specific external Security Solution. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param externalSecuritySolutionsName Name of an external security solution. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a specific external Security Solution. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String ascLocation, String externalSecuritySolutionsName) { + return getWithResponseAsync(resourceGroupName, ascLocation, externalSecuritySolutionsName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a specific external Security Solution. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param externalSecuritySolutionsName Name of an external security solution. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a specific external Security Solution. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ExternalSecuritySolutionInner get( + String resourceGroupName, String ascLocation, String externalSecuritySolutionsName) { + return getAsync(resourceGroupName, ascLocation, externalSecuritySolutionsName).block(); + } + + /** + * Gets a specific external Security Solution. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param externalSecuritySolutionsName Name of an external security solution. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a specific external Security Solution. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String ascLocation, String externalSecuritySolutionsName, Context context) { + return getWithResponseAsync(resourceGroupName, ascLocation, externalSecuritySolutionsName, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByHomeRegionNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByHomeRegionNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByHomeRegionNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByHomeRegionNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ExternalSecuritySolutionsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ExternalSecuritySolutionsImpl.java new file mode 100644 index 000000000000..08366a5ccede --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ExternalSecuritySolutionsImpl.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.ExternalSecuritySolutionsClient; +import com.azure.resourcemanager.security.fluent.models.ExternalSecuritySolutionInner; +import com.azure.resourcemanager.security.models.ExternalSecuritySolution; +import com.azure.resourcemanager.security.models.ExternalSecuritySolutions; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ExternalSecuritySolutionsImpl implements ExternalSecuritySolutions { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ExternalSecuritySolutionsImpl.class); + + private final ExternalSecuritySolutionsClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public ExternalSecuritySolutionsImpl( + ExternalSecuritySolutionsClient innerClient, + com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new ExternalSecuritySolutionImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new ExternalSecuritySolutionImpl(inner1, this.manager())); + } + + public PagedIterable listByHomeRegion(String ascLocation) { + PagedIterable inner = this.serviceClient().listByHomeRegion(ascLocation); + return Utils.mapPage(inner, inner1 -> new ExternalSecuritySolutionImpl(inner1, this.manager())); + } + + public PagedIterable listByHomeRegion(String ascLocation, Context context) { + PagedIterable inner = + this.serviceClient().listByHomeRegion(ascLocation, context); + return Utils.mapPage(inner, inner1 -> new ExternalSecuritySolutionImpl(inner1, this.manager())); + } + + public ExternalSecuritySolution get( + String resourceGroupName, String ascLocation, String externalSecuritySolutionsName) { + ExternalSecuritySolutionInner inner = + this.serviceClient().get(resourceGroupName, ascLocation, externalSecuritySolutionsName); + if (inner != null) { + return new ExternalSecuritySolutionImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String ascLocation, String externalSecuritySolutionsName, Context context) { + Response inner = + this + .serviceClient() + .getWithResponse(resourceGroupName, ascLocation, externalSecuritySolutionsName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ExternalSecuritySolutionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private ExternalSecuritySolutionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/InformationProtectionPoliciesClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/InformationProtectionPoliciesClientImpl.java new file mode 100644 index 000000000000..cb1e41b157b8 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/InformationProtectionPoliciesClientImpl.java @@ -0,0 +1,658 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.InformationProtectionPoliciesClient; +import com.azure.resourcemanager.security.fluent.models.InformationProtectionPolicyInner; +import com.azure.resourcemanager.security.models.InformationProtectionPoliciesInformationProtectionPolicyName; +import com.azure.resourcemanager.security.models.InformationProtectionPolicyList; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in InformationProtectionPoliciesClient. */ +public final class InformationProtectionPoliciesClientImpl implements InformationProtectionPoliciesClient { + private final ClientLogger logger = new ClientLogger(InformationProtectionPoliciesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final InformationProtectionPoliciesService service; + + /** The service client containing this operation class. */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of InformationProtectionPoliciesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + InformationProtectionPoliciesClientImpl(SecurityCenterImpl client) { + this.service = + RestProxy + .create( + InformationProtectionPoliciesService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterInformationProtectionPolicies to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityCenterInform") + private interface InformationProtectionPoliciesService { + @Headers({"Content-Type: application/json"}) + @Get("/{scope}/providers/Microsoft.Security/informationProtectionPolicies/{informationProtectionPolicyName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "scope", encoded = true) String scope, + @PathParam("informationProtectionPolicyName") + InformationProtectionPoliciesInformationProtectionPolicyName informationProtectionPolicyName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put("/{scope}/providers/Microsoft.Security/informationProtectionPolicies/{informationProtectionPolicyName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "scope", encoded = true) String scope, + @PathParam("informationProtectionPolicyName") + InformationProtectionPoliciesInformationProtectionPolicyName informationProtectionPolicyName, + @BodyParam("application/json") InformationProtectionPolicyInner informationProtectionPolicy, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/{scope}/providers/Microsoft.Security/informationProtectionPolicies") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "scope", encoded = true) String scope, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Details of the information protection policy. + * + * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @param informationProtectionPolicyName Name of the information protection policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information protection policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String scope, InformationProtectionPoliciesInformationProtectionPolicyName informationProtectionPolicyName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (informationProtectionPolicyName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter informationProtectionPolicyName is required and cannot be null.")); + } + final String apiVersion = "2017-08-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + apiVersion, + scope, + informationProtectionPolicyName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Details of the information protection policy. + * + * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @param informationProtectionPolicyName Name of the information protection policy. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information protection policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String scope, + InformationProtectionPoliciesInformationProtectionPolicyName informationProtectionPolicyName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (informationProtectionPolicyName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter informationProtectionPolicyName is required and cannot be null.")); + } + final String apiVersion = "2017-08-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get(this.client.getEndpoint(), apiVersion, scope, informationProtectionPolicyName, accept, context); + } + + /** + * Details of the information protection policy. + * + * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @param informationProtectionPolicyName Name of the information protection policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information protection policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String scope, InformationProtectionPoliciesInformationProtectionPolicyName informationProtectionPolicyName) { + return getWithResponseAsync(scope, informationProtectionPolicyName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Details of the information protection policy. + * + * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @param informationProtectionPolicyName Name of the information protection policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information protection policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public InformationProtectionPolicyInner get( + String scope, InformationProtectionPoliciesInformationProtectionPolicyName informationProtectionPolicyName) { + return getAsync(scope, informationProtectionPolicyName).block(); + } + + /** + * Details of the information protection policy. + * + * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @param informationProtectionPolicyName Name of the information protection policy. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information protection policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String scope, + InformationProtectionPoliciesInformationProtectionPolicyName informationProtectionPolicyName, + Context context) { + return getWithResponseAsync(scope, informationProtectionPolicyName, context).block(); + } + + /** + * Details of the information protection policy. + * + * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @param informationProtectionPolicyName Name of the information protection policy. + * @param informationProtectionPolicy Information protection policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information protection policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String scope, + InformationProtectionPoliciesInformationProtectionPolicyName informationProtectionPolicyName, + InformationProtectionPolicyInner informationProtectionPolicy) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (informationProtectionPolicyName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter informationProtectionPolicyName is required and cannot be null.")); + } + if (informationProtectionPolicy == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter informationProtectionPolicy is required and cannot be null.")); + } else { + informationProtectionPolicy.validate(); + } + final String apiVersion = "2017-08-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + apiVersion, + scope, + informationProtectionPolicyName, + informationProtectionPolicy, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Details of the information protection policy. + * + * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @param informationProtectionPolicyName Name of the information protection policy. + * @param informationProtectionPolicy Information protection policy. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information protection policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String scope, + InformationProtectionPoliciesInformationProtectionPolicyName informationProtectionPolicyName, + InformationProtectionPolicyInner informationProtectionPolicy, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (informationProtectionPolicyName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter informationProtectionPolicyName is required and cannot be null.")); + } + if (informationProtectionPolicy == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter informationProtectionPolicy is required and cannot be null.")); + } else { + informationProtectionPolicy.validate(); + } + final String apiVersion = "2017-08-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + apiVersion, + scope, + informationProtectionPolicyName, + informationProtectionPolicy, + accept, + context); + } + + /** + * Details of the information protection policy. + * + * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @param informationProtectionPolicyName Name of the information protection policy. + * @param informationProtectionPolicy Information protection policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information protection policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String scope, + InformationProtectionPoliciesInformationProtectionPolicyName informationProtectionPolicyName, + InformationProtectionPolicyInner informationProtectionPolicy) { + return createOrUpdateWithResponseAsync(scope, informationProtectionPolicyName, informationProtectionPolicy) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Details of the information protection policy. + * + * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @param informationProtectionPolicyName Name of the information protection policy. + * @param informationProtectionPolicy Information protection policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information protection policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public InformationProtectionPolicyInner createOrUpdate( + String scope, + InformationProtectionPoliciesInformationProtectionPolicyName informationProtectionPolicyName, + InformationProtectionPolicyInner informationProtectionPolicy) { + return createOrUpdateAsync(scope, informationProtectionPolicyName, informationProtectionPolicy).block(); + } + + /** + * Details of the information protection policy. + * + * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @param informationProtectionPolicyName Name of the information protection policy. + * @param informationProtectionPolicy Information protection policy. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information protection policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String scope, + InformationProtectionPoliciesInformationProtectionPolicyName informationProtectionPolicyName, + InformationProtectionPolicyInner informationProtectionPolicy, + Context context) { + return createOrUpdateWithResponseAsync( + scope, informationProtectionPolicyName, informationProtectionPolicy, context) + .block(); + } + + /** + * Information protection policies of a specific management group. + * + * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information protection policies response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String scope) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + final String apiVersion = "2017-08-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), apiVersion, scope, accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Information protection policies of a specific management group. + * + * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information protection policies response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String scope, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + final String apiVersion = "2017-08-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), apiVersion, scope, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Information protection policies of a specific management group. + * + * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information protection policies response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String scope) { + return new PagedFlux<>(() -> listSinglePageAsync(scope), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Information protection policies of a specific management group. + * + * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information protection policies response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String scope, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(scope, context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Information protection policies of a specific management group. + * + * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information protection policies response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String scope) { + return new PagedIterable<>(listAsync(scope)); + } + + /** + * Information protection policies of a specific management group. + * + * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information protection policies response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String scope, Context context) { + return new PagedIterable<>(listAsync(scope, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information protection policies response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information protection policies response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/InformationProtectionPoliciesImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/InformationProtectionPoliciesImpl.java new file mode 100644 index 000000000000..ce6a578a8706 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/InformationProtectionPoliciesImpl.java @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.InformationProtectionPoliciesClient; +import com.azure.resourcemanager.security.fluent.models.InformationProtectionPolicyInner; +import com.azure.resourcemanager.security.models.InformationProtectionPolicies; +import com.azure.resourcemanager.security.models.InformationProtectionPoliciesInformationProtectionPolicyName; +import com.azure.resourcemanager.security.models.InformationProtectionPolicy; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class InformationProtectionPoliciesImpl implements InformationProtectionPolicies { + @JsonIgnore private final ClientLogger logger = new ClientLogger(InformationProtectionPoliciesImpl.class); + + private final InformationProtectionPoliciesClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public InformationProtectionPoliciesImpl( + InformationProtectionPoliciesClient innerClient, + com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public InformationProtectionPolicy get( + String scope, InformationProtectionPoliciesInformationProtectionPolicyName informationProtectionPolicyName) { + InformationProtectionPolicyInner inner = this.serviceClient().get(scope, informationProtectionPolicyName); + if (inner != null) { + return new InformationProtectionPolicyImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String scope, + InformationProtectionPoliciesInformationProtectionPolicyName informationProtectionPolicyName, + Context context) { + Response inner = + this.serviceClient().getWithResponse(scope, informationProtectionPolicyName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new InformationProtectionPolicyImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable list(String scope) { + PagedIterable inner = this.serviceClient().list(scope); + return Utils.mapPage(inner, inner1 -> new InformationProtectionPolicyImpl(inner1, this.manager())); + } + + public PagedIterable list(String scope, Context context) { + PagedIterable inner = this.serviceClient().list(scope, context); + return Utils.mapPage(inner, inner1 -> new InformationProtectionPolicyImpl(inner1, this.manager())); + } + + public InformationProtectionPolicy getById(String id) { + String scope = + Utils + .getValueFromIdByParameterName( + id, + "/{scope}/providers/Microsoft.Security/informationProtectionPolicies" + + "/{informationProtectionPolicyName}", + "scope"); + if (scope == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'scope'.", id))); + } + InformationProtectionPoliciesInformationProtectionPolicyName informationProtectionPolicyName = + InformationProtectionPoliciesInformationProtectionPolicyName + .fromString( + Utils + .getValueFromIdByParameterName( + id, + "/{scope}/providers/Microsoft.Security/informationProtectionPolicies" + + "/{informationProtectionPolicyName}", + "informationProtectionPolicyName")); + if (informationProtectionPolicyName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment" + + " 'informationProtectionPolicies'.", + id))); + } + return this.getWithResponse(scope, informationProtectionPolicyName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String scope = + Utils + .getValueFromIdByParameterName( + id, + "/{scope}/providers/Microsoft.Security/informationProtectionPolicies" + + "/{informationProtectionPolicyName}", + "scope"); + if (scope == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'scope'.", id))); + } + InformationProtectionPoliciesInformationProtectionPolicyName informationProtectionPolicyName = + InformationProtectionPoliciesInformationProtectionPolicyName + .fromString( + Utils + .getValueFromIdByParameterName( + id, + "/{scope}/providers/Microsoft.Security/informationProtectionPolicies" + + "/{informationProtectionPolicyName}", + "informationProtectionPolicyName")); + if (informationProtectionPolicyName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment" + + " 'informationProtectionPolicies'.", + id))); + } + return this.getWithResponse(scope, informationProtectionPolicyName, context); + } + + private InformationProtectionPoliciesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } + + public InformationProtectionPolicyImpl define(InformationProtectionPoliciesInformationProtectionPolicyName name) { + return new InformationProtectionPolicyImpl(name, this.manager()); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/InformationProtectionPolicyImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/InformationProtectionPolicyImpl.java new file mode 100644 index 000000000000..ca0107ed1389 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/InformationProtectionPolicyImpl.java @@ -0,0 +1,182 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.InformationProtectionPolicyInner; +import com.azure.resourcemanager.security.models.InformationProtectionPoliciesInformationProtectionPolicyName; +import com.azure.resourcemanager.security.models.InformationProtectionPolicy; +import com.azure.resourcemanager.security.models.InformationType; +import com.azure.resourcemanager.security.models.SensitivityLabel; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.Map; + +public final class InformationProtectionPolicyImpl + implements InformationProtectionPolicy, InformationProtectionPolicy.Definition, InformationProtectionPolicy.Update { + private InformationProtectionPolicyInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public OffsetDateTime lastModifiedUtc() { + return this.innerModel().lastModifiedUtc(); + } + + public String version() { + return this.innerModel().version(); + } + + public Map labels() { + Map inner = this.innerModel().labels(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public Map informationTypes() { + Map inner = this.innerModel().informationTypes(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public InformationProtectionPolicyInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } + + private String scope; + + private InformationProtectionPoliciesInformationProtectionPolicyName informationProtectionPolicyName; + + public InformationProtectionPolicyImpl withExistingScope(String scope) { + this.scope = scope; + return this; + } + + public InformationProtectionPolicy create() { + this.innerObject = + serviceManager + .serviceClient() + .getInformationProtectionPolicies() + .createOrUpdateWithResponse(scope, informationProtectionPolicyName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public InformationProtectionPolicy create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getInformationProtectionPolicies() + .createOrUpdateWithResponse(scope, informationProtectionPolicyName, this.innerModel(), context) + .getValue(); + return this; + } + + InformationProtectionPolicyImpl( + InformationProtectionPoliciesInformationProtectionPolicyName name, + com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = new InformationProtectionPolicyInner(); + this.serviceManager = serviceManager; + this.informationProtectionPolicyName = name; + } + + public InformationProtectionPolicyImpl update() { + return this; + } + + public InformationProtectionPolicy apply() { + this.innerObject = + serviceManager + .serviceClient() + .getInformationProtectionPolicies() + .createOrUpdateWithResponse(scope, informationProtectionPolicyName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public InformationProtectionPolicy apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getInformationProtectionPolicies() + .createOrUpdateWithResponse(scope, informationProtectionPolicyName, this.innerModel(), context) + .getValue(); + return this; + } + + InformationProtectionPolicyImpl( + InformationProtectionPolicyInner innerObject, + com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.scope = + Utils + .getValueFromIdByParameterName( + innerObject.id(), + "/{scope}/providers/Microsoft.Security/informationProtectionPolicies" + + "/{informationProtectionPolicyName}", + "scope"); + this.informationProtectionPolicyName = + InformationProtectionPoliciesInformationProtectionPolicyName + .fromString( + Utils + .getValueFromIdByParameterName( + innerObject.id(), + "/{scope}/providers/Microsoft.Security/informationProtectionPolicies" + + "/{informationProtectionPolicyName}", + "informationProtectionPolicyName")); + } + + public InformationProtectionPolicy refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getInformationProtectionPolicies() + .getWithResponse(scope, informationProtectionPolicyName, Context.NONE) + .getValue(); + return this; + } + + public InformationProtectionPolicy refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getInformationProtectionPolicies() + .getWithResponse(scope, informationProtectionPolicyName, context) + .getValue(); + return this; + } + + public InformationProtectionPolicyImpl withLabels(Map labels) { + this.innerModel().withLabels(labels); + return this; + } + + public InformationProtectionPolicyImpl withInformationTypes(Map informationTypes) { + this.innerModel().withInformationTypes(informationTypes); + return this; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IngestionSettingImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IngestionSettingImpl.java new file mode 100644 index 000000000000..41227d628353 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IngestionSettingImpl.java @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.IngestionSettingInner; +import com.azure.resourcemanager.security.models.ConnectionStrings; +import com.azure.resourcemanager.security.models.IngestionSetting; +import com.azure.resourcemanager.security.models.IngestionSettingToken; + +public final class IngestionSettingImpl implements IngestionSetting, IngestionSetting.Definition { + private IngestionSettingInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + IngestionSettingImpl( + IngestionSettingInner innerObject, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public Object properties() { + return this.innerModel().properties(); + } + + public IngestionSettingInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } + + private String ingestionSettingName; + + public IngestionSetting create() { + this.innerObject = + serviceManager + .serviceClient() + .getIngestionSettings() + .createWithResponse(ingestionSettingName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public IngestionSetting create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getIngestionSettings() + .createWithResponse(ingestionSettingName, this.innerModel(), context) + .getValue(); + return this; + } + + IngestionSettingImpl(String name, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = new IngestionSettingInner(); + this.serviceManager = serviceManager; + this.ingestionSettingName = name; + } + + public IngestionSetting refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getIngestionSettings() + .getWithResponse(ingestionSettingName, Context.NONE) + .getValue(); + return this; + } + + public IngestionSetting refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getIngestionSettings() + .getWithResponse(ingestionSettingName, context) + .getValue(); + return this; + } + + public IngestionSettingToken listTokens() { + return serviceManager.ingestionSettings().listTokens(ingestionSettingName); + } + + public Response listTokensWithResponse(Context context) { + return serviceManager.ingestionSettings().listTokensWithResponse(ingestionSettingName, context); + } + + public ConnectionStrings listConnectionStrings() { + return serviceManager.ingestionSettings().listConnectionStrings(ingestionSettingName); + } + + public Response listConnectionStringsWithResponse(Context context) { + return serviceManager.ingestionSettings().listConnectionStringsWithResponse(ingestionSettingName, context); + } + + public IngestionSettingImpl withProperties(Object properties) { + this.innerModel().withProperties(properties); + return this; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IngestionSettingTokenImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IngestionSettingTokenImpl.java new file mode 100644 index 000000000000..260f3548df8f --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IngestionSettingTokenImpl.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.resourcemanager.security.fluent.models.IngestionSettingTokenInner; +import com.azure.resourcemanager.security.models.IngestionSettingToken; + +public final class IngestionSettingTokenImpl implements IngestionSettingToken { + private IngestionSettingTokenInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + IngestionSettingTokenImpl( + IngestionSettingTokenInner innerObject, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String token() { + return this.innerModel().token(); + } + + public IngestionSettingTokenInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IngestionSettingsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IngestionSettingsClientImpl.java new file mode 100644 index 000000000000..ecabfaf06dd8 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IngestionSettingsClientImpl.java @@ -0,0 +1,1049 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.IngestionSettingsClient; +import com.azure.resourcemanager.security.fluent.models.ConnectionStringsInner; +import com.azure.resourcemanager.security.fluent.models.IngestionSettingInner; +import com.azure.resourcemanager.security.fluent.models.IngestionSettingTokenInner; +import com.azure.resourcemanager.security.models.IngestionSettingList; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in IngestionSettingsClient. */ +public final class IngestionSettingsClientImpl implements IngestionSettingsClient { + private final ClientLogger logger = new ClientLogger(IngestionSettingsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final IngestionSettingsService service; + + /** The service client containing this operation class. */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of IngestionSettingsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + IngestionSettingsClientImpl(SecurityCenterImpl client) { + this.service = + RestProxy.create(IngestionSettingsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterIngestionSettings to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityCenterIngest") + private interface IngestionSettingsService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("ingestionSettingName") String ingestionSettingName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put("/subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> create( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("ingestionSettingName") String ingestionSettingName, + @BodyParam("application/json") IngestionSettingInner ingestionSetting, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete("/subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("ingestionSettingName") String ingestionSettingName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName}" + + "/listTokens") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listTokens( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("ingestionSettingName") String ingestionSettingName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName}" + + "/listConnectionStrings") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listConnectionStrings( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("ingestionSettingName") String ingestionSettingName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Settings for ingesting security data and logs to correlate with resources associated with the subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of ingestion settings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-01-15-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Settings for ingesting security data and logs to correlate with resources associated with the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of ingestion settings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-01-15-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Settings for ingesting security data and logs to correlate with resources associated with the subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of ingestion settings. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Settings for ingesting security data and logs to correlate with resources associated with the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of ingestion settings. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Settings for ingesting security data and logs to correlate with resources associated with the subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of ingestion settings. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Settings for ingesting security data and logs to correlate with resources associated with the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of ingestion settings. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Settings for ingesting security data and logs to correlate with resources associated with the subscription. + * + * @param ingestionSettingName Name of the ingestion setting. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return configures how to correlate scan data and logs with resources associated with the subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String ingestionSettingName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (ingestionSettingName == null) { + return Mono + .error(new IllegalArgumentException("Parameter ingestionSettingName is required and cannot be null.")); + } + final String apiVersion = "2021-01-15-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + ingestionSettingName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Settings for ingesting security data and logs to correlate with resources associated with the subscription. + * + * @param ingestionSettingName Name of the ingestion setting. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return configures how to correlate scan data and logs with resources associated with the subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String ingestionSettingName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (ingestionSettingName == null) { + return Mono + .error(new IllegalArgumentException("Parameter ingestionSettingName is required and cannot be null.")); + } + final String apiVersion = "2021-01-15-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + ingestionSettingName, + accept, + context); + } + + /** + * Settings for ingesting security data and logs to correlate with resources associated with the subscription. + * + * @param ingestionSettingName Name of the ingestion setting. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return configures how to correlate scan data and logs with resources associated with the subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String ingestionSettingName) { + return getWithResponseAsync(ingestionSettingName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Settings for ingesting security data and logs to correlate with resources associated with the subscription. + * + * @param ingestionSettingName Name of the ingestion setting. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return configures how to correlate scan data and logs with resources associated with the subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public IngestionSettingInner get(String ingestionSettingName) { + return getAsync(ingestionSettingName).block(); + } + + /** + * Settings for ingesting security data and logs to correlate with resources associated with the subscription. + * + * @param ingestionSettingName Name of the ingestion setting. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return configures how to correlate scan data and logs with resources associated with the subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String ingestionSettingName, Context context) { + return getWithResponseAsync(ingestionSettingName, context).block(); + } + + /** + * Create setting for ingesting security data and logs to correlate with resources associated with the subscription. + * + * @param ingestionSettingName Name of the ingestion setting. + * @param ingestionSetting Ingestion setting object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return configures how to correlate scan data and logs with resources associated with the subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync( + String ingestionSettingName, IngestionSettingInner ingestionSetting) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (ingestionSettingName == null) { + return Mono + .error(new IllegalArgumentException("Parameter ingestionSettingName is required and cannot be null.")); + } + if (ingestionSetting == null) { + return Mono + .error(new IllegalArgumentException("Parameter ingestionSetting is required and cannot be null.")); + } else { + ingestionSetting.validate(); + } + final String apiVersion = "2021-01-15-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .create( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + ingestionSettingName, + ingestionSetting, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create setting for ingesting security data and logs to correlate with resources associated with the subscription. + * + * @param ingestionSettingName Name of the ingestion setting. + * @param ingestionSetting Ingestion setting object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return configures how to correlate scan data and logs with resources associated with the subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync( + String ingestionSettingName, IngestionSettingInner ingestionSetting, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (ingestionSettingName == null) { + return Mono + .error(new IllegalArgumentException("Parameter ingestionSettingName is required and cannot be null.")); + } + if (ingestionSetting == null) { + return Mono + .error(new IllegalArgumentException("Parameter ingestionSetting is required and cannot be null.")); + } else { + ingestionSetting.validate(); + } + final String apiVersion = "2021-01-15-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .create( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + ingestionSettingName, + ingestionSetting, + accept, + context); + } + + /** + * Create setting for ingesting security data and logs to correlate with resources associated with the subscription. + * + * @param ingestionSettingName Name of the ingestion setting. + * @param ingestionSetting Ingestion setting object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return configures how to correlate scan data and logs with resources associated with the subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String ingestionSettingName, IngestionSettingInner ingestionSetting) { + return createWithResponseAsync(ingestionSettingName, ingestionSetting) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Create setting for ingesting security data and logs to correlate with resources associated with the subscription. + * + * @param ingestionSettingName Name of the ingestion setting. + * @param ingestionSetting Ingestion setting object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return configures how to correlate scan data and logs with resources associated with the subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public IngestionSettingInner create(String ingestionSettingName, IngestionSettingInner ingestionSetting) { + return createAsync(ingestionSettingName, ingestionSetting).block(); + } + + /** + * Create setting for ingesting security data and logs to correlate with resources associated with the subscription. + * + * @param ingestionSettingName Name of the ingestion setting. + * @param ingestionSetting Ingestion setting object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return configures how to correlate scan data and logs with resources associated with the subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createWithResponse( + String ingestionSettingName, IngestionSettingInner ingestionSetting, Context context) { + return createWithResponseAsync(ingestionSettingName, ingestionSetting, context).block(); + } + + /** + * Deletes the ingestion settings for this subscription. + * + * @param ingestionSettingName Name of the ingestion setting. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String ingestionSettingName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (ingestionSettingName == null) { + return Mono + .error(new IllegalArgumentException("Parameter ingestionSettingName is required and cannot be null.")); + } + final String apiVersion = "2021-01-15-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + ingestionSettingName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes the ingestion settings for this subscription. + * + * @param ingestionSettingName Name of the ingestion setting. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String ingestionSettingName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (ingestionSettingName == null) { + return Mono + .error(new IllegalArgumentException("Parameter ingestionSettingName is required and cannot be null.")); + } + final String apiVersion = "2021-01-15-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + ingestionSettingName, + accept, + context); + } + + /** + * Deletes the ingestion settings for this subscription. + * + * @param ingestionSettingName Name of the ingestion setting. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String ingestionSettingName) { + return deleteWithResponseAsync(ingestionSettingName).flatMap((Response res) -> Mono.empty()); + } + + /** + * Deletes the ingestion settings for this subscription. + * + * @param ingestionSettingName Name of the ingestion setting. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String ingestionSettingName) { + deleteAsync(ingestionSettingName).block(); + } + + /** + * Deletes the ingestion settings for this subscription. + * + * @param ingestionSettingName Name of the ingestion setting. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String ingestionSettingName, Context context) { + return deleteWithResponseAsync(ingestionSettingName, context).block(); + } + + /** + * Returns the token that is used for correlating ingested telemetry with the resources in the subscription. + * + * @param ingestionSettingName Name of the ingestion setting. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return configures how to correlate scan data and logs with resources associated with the subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listTokensWithResponseAsync(String ingestionSettingName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (ingestionSettingName == null) { + return Mono + .error(new IllegalArgumentException("Parameter ingestionSettingName is required and cannot be null.")); + } + final String apiVersion = "2021-01-15-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listTokens( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + ingestionSettingName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Returns the token that is used for correlating ingested telemetry with the resources in the subscription. + * + * @param ingestionSettingName Name of the ingestion setting. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return configures how to correlate scan data and logs with resources associated with the subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listTokensWithResponseAsync( + String ingestionSettingName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (ingestionSettingName == null) { + return Mono + .error(new IllegalArgumentException("Parameter ingestionSettingName is required and cannot be null.")); + } + final String apiVersion = "2021-01-15-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listTokens( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + ingestionSettingName, + accept, + context); + } + + /** + * Returns the token that is used for correlating ingested telemetry with the resources in the subscription. + * + * @param ingestionSettingName Name of the ingestion setting. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return configures how to correlate scan data and logs with resources associated with the subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listTokensAsync(String ingestionSettingName) { + return listTokensWithResponseAsync(ingestionSettingName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Returns the token that is used for correlating ingested telemetry with the resources in the subscription. + * + * @param ingestionSettingName Name of the ingestion setting. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return configures how to correlate scan data and logs with resources associated with the subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public IngestionSettingTokenInner listTokens(String ingestionSettingName) { + return listTokensAsync(ingestionSettingName).block(); + } + + /** + * Returns the token that is used for correlating ingested telemetry with the resources in the subscription. + * + * @param ingestionSettingName Name of the ingestion setting. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return configures how to correlate scan data and logs with resources associated with the subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listTokensWithResponse(String ingestionSettingName, Context context) { + return listTokensWithResponseAsync(ingestionSettingName, context).block(); + } + + /** + * Connection strings for ingesting security scan logs and data. + * + * @param ingestionSettingName Name of the ingestion setting. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return connection string for ingesting security data and logs. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listConnectionStringsWithResponseAsync(String ingestionSettingName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (ingestionSettingName == null) { + return Mono + .error(new IllegalArgumentException("Parameter ingestionSettingName is required and cannot be null.")); + } + final String apiVersion = "2021-01-15-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listConnectionStrings( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + ingestionSettingName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Connection strings for ingesting security scan logs and data. + * + * @param ingestionSettingName Name of the ingestion setting. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return connection string for ingesting security data and logs. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listConnectionStringsWithResponseAsync( + String ingestionSettingName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (ingestionSettingName == null) { + return Mono + .error(new IllegalArgumentException("Parameter ingestionSettingName is required and cannot be null.")); + } + final String apiVersion = "2021-01-15-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listConnectionStrings( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + ingestionSettingName, + accept, + context); + } + + /** + * Connection strings for ingesting security scan logs and data. + * + * @param ingestionSettingName Name of the ingestion setting. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return connection string for ingesting security data and logs. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listConnectionStringsAsync(String ingestionSettingName) { + return listConnectionStringsWithResponseAsync(ingestionSettingName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Connection strings for ingesting security scan logs and data. + * + * @param ingestionSettingName Name of the ingestion setting. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return connection string for ingesting security data and logs. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ConnectionStringsInner listConnectionStrings(String ingestionSettingName) { + return listConnectionStringsAsync(ingestionSettingName).block(); + } + + /** + * Connection strings for ingesting security scan logs and data. + * + * @param ingestionSettingName Name of the ingestion setting. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return connection string for ingesting security data and logs. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listConnectionStringsWithResponse( + String ingestionSettingName, Context context) { + return listConnectionStringsWithResponseAsync(ingestionSettingName, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of ingestion settings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of ingestion settings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IngestionSettingsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IngestionSettingsImpl.java new file mode 100644 index 000000000000..57bb043e7b8e --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IngestionSettingsImpl.java @@ -0,0 +1,184 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.IngestionSettingsClient; +import com.azure.resourcemanager.security.fluent.models.ConnectionStringsInner; +import com.azure.resourcemanager.security.fluent.models.IngestionSettingInner; +import com.azure.resourcemanager.security.fluent.models.IngestionSettingTokenInner; +import com.azure.resourcemanager.security.models.ConnectionStrings; +import com.azure.resourcemanager.security.models.IngestionSetting; +import com.azure.resourcemanager.security.models.IngestionSettingToken; +import com.azure.resourcemanager.security.models.IngestionSettings; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class IngestionSettingsImpl implements IngestionSettings { + @JsonIgnore private final ClientLogger logger = new ClientLogger(IngestionSettingsImpl.class); + + private final IngestionSettingsClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public IngestionSettingsImpl( + IngestionSettingsClient innerClient, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new IngestionSettingImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new IngestionSettingImpl(inner1, this.manager())); + } + + public IngestionSetting get(String ingestionSettingName) { + IngestionSettingInner inner = this.serviceClient().get(ingestionSettingName); + if (inner != null) { + return new IngestionSettingImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse(String ingestionSettingName, Context context) { + Response inner = this.serviceClient().getWithResponse(ingestionSettingName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new IngestionSettingImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String ingestionSettingName) { + this.serviceClient().delete(ingestionSettingName); + } + + public Response deleteWithResponse(String ingestionSettingName, Context context) { + return this.serviceClient().deleteWithResponse(ingestionSettingName, context); + } + + public IngestionSettingToken listTokens(String ingestionSettingName) { + IngestionSettingTokenInner inner = this.serviceClient().listTokens(ingestionSettingName); + if (inner != null) { + return new IngestionSettingTokenImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response listTokensWithResponse(String ingestionSettingName, Context context) { + Response inner = + this.serviceClient().listTokensWithResponse(ingestionSettingName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new IngestionSettingTokenImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ConnectionStrings listConnectionStrings(String ingestionSettingName) { + ConnectionStringsInner inner = this.serviceClient().listConnectionStrings(ingestionSettingName); + if (inner != null) { + return new ConnectionStringsImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response listConnectionStringsWithResponse(String ingestionSettingName, Context context) { + Response inner = + this.serviceClient().listConnectionStringsWithResponse(ingestionSettingName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ConnectionStringsImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public IngestionSetting getById(String id) { + String ingestionSettingName = Utils.getValueFromIdByName(id, "ingestionSettings"); + if (ingestionSettingName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'ingestionSettings'.", id))); + } + return this.getWithResponse(ingestionSettingName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String ingestionSettingName = Utils.getValueFromIdByName(id, "ingestionSettings"); + if (ingestionSettingName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'ingestionSettings'.", id))); + } + return this.getWithResponse(ingestionSettingName, context); + } + + public void deleteById(String id) { + String ingestionSettingName = Utils.getValueFromIdByName(id, "ingestionSettings"); + if (ingestionSettingName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'ingestionSettings'.", id))); + } + this.deleteWithResponse(ingestionSettingName, Context.NONE).getValue(); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String ingestionSettingName = Utils.getValueFromIdByName(id, "ingestionSettings"); + if (ingestionSettingName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'ingestionSettings'.", id))); + } + return this.deleteWithResponse(ingestionSettingName, context); + } + + private IngestionSettingsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } + + public IngestionSettingImpl define(String name) { + return new IngestionSettingImpl(name, this.manager()); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IoTSecurityAggregatedAlertImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IoTSecurityAggregatedAlertImpl.java new file mode 100644 index 000000000000..fbc01e3a78e9 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IoTSecurityAggregatedAlertImpl.java @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.resourcemanager.security.fluent.models.IoTSecurityAggregatedAlertInner; +import com.azure.resourcemanager.security.models.IoTSecurityAggregatedAlert; +import com.azure.resourcemanager.security.models.IoTSecurityAggregatedAlertPropertiesTopDevicesListItem; +import com.azure.resourcemanager.security.models.ReportedSeverity; +import java.time.LocalDate; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public final class IoTSecurityAggregatedAlertImpl implements IoTSecurityAggregatedAlert { + private IoTSecurityAggregatedAlertInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + IoTSecurityAggregatedAlertImpl( + IoTSecurityAggregatedAlertInner innerObject, + com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String alertType() { + return this.innerModel().alertType(); + } + + public String alertDisplayName() { + return this.innerModel().alertDisplayName(); + } + + public LocalDate aggregatedDateUtc() { + return this.innerModel().aggregatedDateUtc(); + } + + public String vendorName() { + return this.innerModel().vendorName(); + } + + public ReportedSeverity reportedSeverity() { + return this.innerModel().reportedSeverity(); + } + + public String remediationSteps() { + return this.innerModel().remediationSteps(); + } + + public String description() { + return this.innerModel().description(); + } + + public Long count() { + return this.innerModel().count(); + } + + public String effectedResourceType() { + return this.innerModel().effectedResourceType(); + } + + public String systemSource() { + return this.innerModel().systemSource(); + } + + public String actionTaken() { + return this.innerModel().actionTaken(); + } + + public String logAnalyticsQuery() { + return this.innerModel().logAnalyticsQuery(); + } + + public List topDevicesList() { + List inner = this.innerModel().topDevicesList(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public IoTSecurityAggregatedAlertInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IoTSecurityAggregatedRecommendationImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IoTSecurityAggregatedRecommendationImpl.java new file mode 100644 index 000000000000..1fde92fa01b2 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IoTSecurityAggregatedRecommendationImpl.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.resourcemanager.security.fluent.models.IoTSecurityAggregatedRecommendationInner; +import com.azure.resourcemanager.security.models.IoTSecurityAggregatedRecommendation; +import com.azure.resourcemanager.security.models.ReportedSeverity; +import java.util.Collections; +import java.util.Map; + +public final class IoTSecurityAggregatedRecommendationImpl implements IoTSecurityAggregatedRecommendation { + private IoTSecurityAggregatedRecommendationInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + IoTSecurityAggregatedRecommendationImpl( + IoTSecurityAggregatedRecommendationInner innerObject, + com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String recommendationName() { + return this.innerModel().recommendationName(); + } + + public String recommendationDisplayName() { + return this.innerModel().recommendationDisplayName(); + } + + public String description() { + return this.innerModel().description(); + } + + public String recommendationTypeId() { + return this.innerModel().recommendationTypeId(); + } + + public String detectedBy() { + return this.innerModel().detectedBy(); + } + + public String remediationSteps() { + return this.innerModel().remediationSteps(); + } + + public ReportedSeverity reportedSeverity() { + return this.innerModel().reportedSeverity(); + } + + public Long healthyDevices() { + return this.innerModel().healthyDevices(); + } + + public Long unhealthyDeviceCount() { + return this.innerModel().unhealthyDeviceCount(); + } + + public String logAnalyticsQuery() { + return this.innerModel().logAnalyticsQuery(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public IoTSecurityAggregatedRecommendationInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IoTSecuritySolutionAnalyticsModelImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IoTSecuritySolutionAnalyticsModelImpl.java new file mode 100644 index 000000000000..40b21a2f1404 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IoTSecuritySolutionAnalyticsModelImpl.java @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.resourcemanager.security.fluent.models.IoTSecuritySolutionAnalyticsModelInner; +import com.azure.resourcemanager.security.models.IoTSecurityAlertedDevice; +import com.azure.resourcemanager.security.models.IoTSecurityDeviceAlert; +import com.azure.resourcemanager.security.models.IoTSecurityDeviceRecommendation; +import com.azure.resourcemanager.security.models.IoTSecuritySolutionAnalyticsModel; +import com.azure.resourcemanager.security.models.IoTSecuritySolutionAnalyticsModelPropertiesDevicesMetricsItem; +import com.azure.resourcemanager.security.models.IoTSeverityMetrics; +import java.util.Collections; +import java.util.List; + +public final class IoTSecuritySolutionAnalyticsModelImpl implements IoTSecuritySolutionAnalyticsModel { + private IoTSecuritySolutionAnalyticsModelInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + IoTSecuritySolutionAnalyticsModelImpl( + IoTSecuritySolutionAnalyticsModelInner innerObject, + com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public IoTSeverityMetrics metrics() { + return this.innerModel().metrics(); + } + + public Long unhealthyDeviceCount() { + return this.innerModel().unhealthyDeviceCount(); + } + + public List devicesMetrics() { + List inner = this.innerModel().devicesMetrics(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List topAlertedDevices() { + List inner = this.innerModel().topAlertedDevices(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List mostPrevalentDeviceAlerts() { + List inner = this.innerModel().mostPrevalentDeviceAlerts(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List mostPrevalentDeviceRecommendations() { + List inner = this.innerModel().mostPrevalentDeviceRecommendations(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public IoTSecuritySolutionAnalyticsModelInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IoTSecuritySolutionAnalyticsModelListImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IoTSecuritySolutionAnalyticsModelListImpl.java new file mode 100644 index 000000000000..f8cf0fe29c55 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IoTSecuritySolutionAnalyticsModelListImpl.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.resourcemanager.security.fluent.models.IoTSecuritySolutionAnalyticsModelInner; +import com.azure.resourcemanager.security.fluent.models.IoTSecuritySolutionAnalyticsModelListInner; +import com.azure.resourcemanager.security.models.IoTSecuritySolutionAnalyticsModel; +import com.azure.resourcemanager.security.models.IoTSecuritySolutionAnalyticsModelList; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +public final class IoTSecuritySolutionAnalyticsModelListImpl implements IoTSecuritySolutionAnalyticsModelList { + private IoTSecuritySolutionAnalyticsModelListInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + IoTSecuritySolutionAnalyticsModelListImpl( + IoTSecuritySolutionAnalyticsModelListInner innerObject, + com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public List value() { + List inner = this.innerModel().value(); + if (inner != null) { + return Collections + .unmodifiableList( + inner + .stream() + .map(inner1 -> new IoTSecuritySolutionAnalyticsModelImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return Collections.emptyList(); + } + } + + public String nextLink() { + return this.innerModel().nextLink(); + } + + public IoTSecuritySolutionAnalyticsModelListInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IoTSecuritySolutionModelImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IoTSecuritySolutionModelImpl.java new file mode 100644 index 000000000000..4445d00a0a81 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IoTSecuritySolutionModelImpl.java @@ -0,0 +1,324 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.IoTSecuritySolutionModelInner; +import com.azure.resourcemanager.security.models.AdditionalWorkspacesProperties; +import com.azure.resourcemanager.security.models.DataSource; +import com.azure.resourcemanager.security.models.ExportData; +import com.azure.resourcemanager.security.models.IoTSecuritySolutionModel; +import com.azure.resourcemanager.security.models.RecommendationConfigurationProperties; +import com.azure.resourcemanager.security.models.SecuritySolutionStatus; +import com.azure.resourcemanager.security.models.UnmaskedIpLoggingStatus; +import com.azure.resourcemanager.security.models.UpdateIotSecuritySolutionData; +import com.azure.resourcemanager.security.models.UserDefinedResourcesProperties; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public final class IoTSecuritySolutionModelImpl + implements IoTSecuritySolutionModel, IoTSecuritySolutionModel.Definition, IoTSecuritySolutionModel.Update { + private IoTSecuritySolutionModelInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String workspace() { + return this.innerModel().workspace(); + } + + public String displayName() { + return this.innerModel().displayName(); + } + + public SecuritySolutionStatus status() { + return this.innerModel().status(); + } + + public List export() { + List inner = this.innerModel().export(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List disabledDataSources() { + List inner = this.innerModel().disabledDataSources(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List iotHubs() { + List inner = this.innerModel().iotHubs(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public UserDefinedResourcesProperties userDefinedResources() { + return this.innerModel().userDefinedResources(); + } + + public List autoDiscoveredResources() { + List inner = this.innerModel().autoDiscoveredResources(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List recommendationsConfiguration() { + List inner = this.innerModel().recommendationsConfiguration(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public UnmaskedIpLoggingStatus unmaskedIpLoggingStatus() { + return this.innerModel().unmaskedIpLoggingStatus(); + } + + public List additionalWorkspaces() { + List inner = this.innerModel().additionalWorkspaces(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public IoTSecuritySolutionModelInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String solutionName; + + private UpdateIotSecuritySolutionData updateUpdateIotSecuritySolutionData; + + public IoTSecuritySolutionModelImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public IoTSecuritySolutionModel create() { + this.innerObject = + serviceManager + .serviceClient() + .getIotSecuritySolutions() + .createOrUpdateWithResponse(resourceGroupName, solutionName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public IoTSecuritySolutionModel create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getIotSecuritySolutions() + .createOrUpdateWithResponse(resourceGroupName, solutionName, this.innerModel(), context) + .getValue(); + return this; + } + + IoTSecuritySolutionModelImpl(String name, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = new IoTSecuritySolutionModelInner(); + this.serviceManager = serviceManager; + this.solutionName = name; + } + + public IoTSecuritySolutionModelImpl update() { + this.updateUpdateIotSecuritySolutionData = new UpdateIotSecuritySolutionData(); + return this; + } + + public IoTSecuritySolutionModel apply() { + this.innerObject = + serviceManager + .serviceClient() + .getIotSecuritySolutions() + .updateWithResponse(resourceGroupName, solutionName, updateUpdateIotSecuritySolutionData, Context.NONE) + .getValue(); + return this; + } + + public IoTSecuritySolutionModel apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getIotSecuritySolutions() + .updateWithResponse(resourceGroupName, solutionName, updateUpdateIotSecuritySolutionData, context) + .getValue(); + return this; + } + + IoTSecuritySolutionModelImpl( + IoTSecuritySolutionModelInner innerObject, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.solutionName = Utils.getValueFromIdByName(innerObject.id(), "iotSecuritySolutions"); + } + + public IoTSecuritySolutionModel refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getIotSecuritySolutions() + .getByResourceGroupWithResponse(resourceGroupName, solutionName, Context.NONE) + .getValue(); + return this; + } + + public IoTSecuritySolutionModel refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getIotSecuritySolutions() + .getByResourceGroupWithResponse(resourceGroupName, solutionName, context) + .getValue(); + return this; + } + + public IoTSecuritySolutionModelImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public IoTSecuritySolutionModelImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public IoTSecuritySolutionModelImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateUpdateIotSecuritySolutionData.withTags(tags); + return this; + } + } + + public IoTSecuritySolutionModelImpl withWorkspace(String workspace) { + this.innerModel().withWorkspace(workspace); + return this; + } + + public IoTSecuritySolutionModelImpl withDisplayName(String displayName) { + this.innerModel().withDisplayName(displayName); + return this; + } + + public IoTSecuritySolutionModelImpl withStatus(SecuritySolutionStatus status) { + this.innerModel().withStatus(status); + return this; + } + + public IoTSecuritySolutionModelImpl withExport(List export) { + this.innerModel().withExport(export); + return this; + } + + public IoTSecuritySolutionModelImpl withDisabledDataSources(List disabledDataSources) { + this.innerModel().withDisabledDataSources(disabledDataSources); + return this; + } + + public IoTSecuritySolutionModelImpl withIotHubs(List iotHubs) { + this.innerModel().withIotHubs(iotHubs); + return this; + } + + public IoTSecuritySolutionModelImpl withUserDefinedResources(UserDefinedResourcesProperties userDefinedResources) { + if (isInCreateMode()) { + this.innerModel().withUserDefinedResources(userDefinedResources); + return this; + } else { + this.updateUpdateIotSecuritySolutionData.withUserDefinedResources(userDefinedResources); + return this; + } + } + + public IoTSecuritySolutionModelImpl withRecommendationsConfiguration( + List recommendationsConfiguration) { + if (isInCreateMode()) { + this.innerModel().withRecommendationsConfiguration(recommendationsConfiguration); + return this; + } else { + this.updateUpdateIotSecuritySolutionData.withRecommendationsConfiguration(recommendationsConfiguration); + return this; + } + } + + public IoTSecuritySolutionModelImpl withUnmaskedIpLoggingStatus(UnmaskedIpLoggingStatus unmaskedIpLoggingStatus) { + this.innerModel().withUnmaskedIpLoggingStatus(unmaskedIpLoggingStatus); + return this; + } + + public IoTSecuritySolutionModelImpl withAdditionalWorkspaces( + List additionalWorkspaces) { + this.innerModel().withAdditionalWorkspaces(additionalWorkspaces); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotAlertModelImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotAlertModelImpl.java new file mode 100644 index 000000000000..c236b0feb0a4 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotAlertModelImpl.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.resourcemanager.security.fluent.models.IotAlertModelInner; +import com.azure.resourcemanager.security.models.IotAlertModel; +import java.util.Collections; +import java.util.List; + +public final class IotAlertModelImpl implements IotAlertModel { + private IotAlertModelInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + IotAlertModelImpl( + IotAlertModelInner innerObject, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String systemAlertId() { + return this.innerModel().systemAlertId(); + } + + public String compromisedEntity() { + return this.innerModel().compromisedEntity(); + } + + public String alertType() { + return this.innerModel().alertType(); + } + + public String startTimeUtc() { + return this.innerModel().startTimeUtc(); + } + + public String endTimeUtc() { + return this.innerModel().endTimeUtc(); + } + + public List entities() { + List inner = this.innerModel().entities(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public Object extendedProperties() { + return this.innerModel().extendedProperties(); + } + + public IotAlertModelInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotAlertTypeImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotAlertTypeImpl.java new file mode 100644 index 000000000000..2a3af4367be5 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotAlertTypeImpl.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.resourcemanager.security.fluent.models.IotAlertTypeInner; +import com.azure.resourcemanager.security.models.AlertIntent; +import com.azure.resourcemanager.security.models.AlertSeverity; +import com.azure.resourcemanager.security.models.IotAlertType; +import java.util.Collections; +import java.util.List; + +public final class IotAlertTypeImpl implements IotAlertType { + private IotAlertTypeInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + IotAlertTypeImpl(IotAlertTypeInner innerObject, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String alertDisplayName() { + return this.innerModel().alertDisplayName(); + } + + public AlertSeverity severity() { + return this.innerModel().severity(); + } + + public String description() { + return this.innerModel().description(); + } + + public String providerName() { + return this.innerModel().providerName(); + } + + public String productName() { + return this.innerModel().productName(); + } + + public String productComponentName() { + return this.innerModel().productComponentName(); + } + + public String vendorName() { + return this.innerModel().vendorName(); + } + + public AlertIntent intent() { + return this.innerModel().intent(); + } + + public List remediationSteps() { + List inner = this.innerModel().remediationSteps(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public IotAlertTypeInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotAlertTypeListImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotAlertTypeListImpl.java new file mode 100644 index 000000000000..70c5b894a55d --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotAlertTypeListImpl.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.resourcemanager.security.fluent.models.IotAlertTypeInner; +import com.azure.resourcemanager.security.fluent.models.IotAlertTypeListInner; +import com.azure.resourcemanager.security.models.IotAlertType; +import com.azure.resourcemanager.security.models.IotAlertTypeList; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +public final class IotAlertTypeListImpl implements IotAlertTypeList { + private IotAlertTypeListInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + IotAlertTypeListImpl( + IotAlertTypeListInner innerObject, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public List value() { + List inner = this.innerModel().value(); + if (inner != null) { + return Collections + .unmodifiableList( + inner + .stream() + .map(inner1 -> new IotAlertTypeImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return Collections.emptyList(); + } + } + + public IotAlertTypeListInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotAlertTypesClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotAlertTypesClientImpl.java new file mode 100644 index 000000000000..ac01b45500fb --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotAlertTypesClientImpl.java @@ -0,0 +1,322 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.IotAlertTypesClient; +import com.azure.resourcemanager.security.fluent.models.IotAlertTypeInner; +import com.azure.resourcemanager.security.fluent.models.IotAlertTypeListInner; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in IotAlertTypesClient. */ +public final class IotAlertTypesClientImpl implements IotAlertTypesClient { + private final ClientLogger logger = new ClientLogger(IotAlertTypesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final IotAlertTypesService service; + + /** The service client containing this operation class. */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of IotAlertTypesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + IotAlertTypesClientImpl(SecurityCenterImpl client) { + this.service = + RestProxy.create(IotAlertTypesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterIotAlertTypes to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityCenterIotAle") + private interface IotAlertTypesService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/iotAlertTypes") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/iotAlertTypes/{iotAlertTypeName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("iotAlertTypeName") String iotAlertTypeName, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List IoT alert types. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of alert types. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listWithResponseAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-08-06-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List IoT alert types. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of alert types. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listWithResponseAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-08-06-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), accept, context); + } + + /** + * List IoT alert types. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of alert types. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listAsync() { + return listWithResponseAsync() + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * List IoT alert types. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of alert types. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public IotAlertTypeListInner list() { + return listAsync().block(); + } + + /** + * List IoT alert types. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of alert types. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listWithResponse(Context context) { + return listWithResponseAsync(context).block(); + } + + /** + * Get IoT alert type. + * + * @param iotAlertTypeName Name of the alert type. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT alert type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String iotAlertTypeName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (iotAlertTypeName == null) { + return Mono + .error(new IllegalArgumentException("Parameter iotAlertTypeName is required and cannot be null.")); + } + final String apiVersion = "2020-08-06-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + iotAlertTypeName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get IoT alert type. + * + * @param iotAlertTypeName Name of the alert type. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT alert type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String iotAlertTypeName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (iotAlertTypeName == null) { + return Mono + .error(new IllegalArgumentException("Parameter iotAlertTypeName is required and cannot be null.")); + } + final String apiVersion = "2020-08-06-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + iotAlertTypeName, + accept, + context); + } + + /** + * Get IoT alert type. + * + * @param iotAlertTypeName Name of the alert type. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT alert type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String iotAlertTypeName) { + return getWithResponseAsync(iotAlertTypeName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get IoT alert type. + * + * @param iotAlertTypeName Name of the alert type. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT alert type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public IotAlertTypeInner get(String iotAlertTypeName) { + return getAsync(iotAlertTypeName).block(); + } + + /** + * Get IoT alert type. + * + * @param iotAlertTypeName Name of the alert type. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT alert type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String iotAlertTypeName, Context context) { + return getWithResponseAsync(iotAlertTypeName, context).block(); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotAlertTypesImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotAlertTypesImpl.java new file mode 100644 index 000000000000..e60002db92f3 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotAlertTypesImpl.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.IotAlertTypesClient; +import com.azure.resourcemanager.security.fluent.models.IotAlertTypeInner; +import com.azure.resourcemanager.security.fluent.models.IotAlertTypeListInner; +import com.azure.resourcemanager.security.models.IotAlertType; +import com.azure.resourcemanager.security.models.IotAlertTypeList; +import com.azure.resourcemanager.security.models.IotAlertTypes; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class IotAlertTypesImpl implements IotAlertTypes { + @JsonIgnore private final ClientLogger logger = new ClientLogger(IotAlertTypesImpl.class); + + private final IotAlertTypesClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public IotAlertTypesImpl( + IotAlertTypesClient innerClient, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public IotAlertTypeList list() { + IotAlertTypeListInner inner = this.serviceClient().list(); + if (inner != null) { + return new IotAlertTypeListImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response listWithResponse(Context context) { + Response inner = this.serviceClient().listWithResponse(context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new IotAlertTypeListImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public IotAlertType get(String iotAlertTypeName) { + IotAlertTypeInner inner = this.serviceClient().get(iotAlertTypeName); + if (inner != null) { + return new IotAlertTypeImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse(String iotAlertTypeName, Context context) { + Response inner = this.serviceClient().getWithResponse(iotAlertTypeName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new IotAlertTypeImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private IotAlertTypesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotAlertsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotAlertsClientImpl.java new file mode 100644 index 000000000000..1ee5d3f55baf --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotAlertsClientImpl.java @@ -0,0 +1,620 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.IotAlertsClient; +import com.azure.resourcemanager.security.fluent.models.IotAlertModelInner; +import com.azure.resourcemanager.security.models.IotAlertListModel; +import com.azure.resourcemanager.security.models.ManagementState; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in IotAlertsClient. */ +public final class IotAlertsClientImpl implements IotAlertsClient { + private final ClientLogger logger = new ClientLogger(IotAlertsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final IotAlertsService service; + + /** The service client containing this operation class. */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of IotAlertsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + IotAlertsClientImpl(SecurityCenterImpl client) { + this.service = + RestProxy.create(IotAlertsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterIotAlerts to be used by the proxy service to perform + * REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityCenterIotAle") + private interface IotAlertsService { + @Headers({"Content-Type: application/json"}) + @Get("/{scope}/providers/Microsoft.Security/iotAlerts") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "scope", encoded = true) String scope, + @QueryParam("startTimeUtc>") String minStartTimeUtc, + @QueryParam("startTimeUtc<") String maxStartTimeUtc, + @QueryParam("alertType") String alertType, + @QueryParam("deviceManagementType") ManagementState deviceManagementType, + @QueryParam("compromisedEntity") String compromisedEntity, + @QueryParam("$limit") Integer limit, + @QueryParam("$skipToken") String skipToken, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/{scope}/providers/Microsoft.Security/iotAlerts/{iotAlertId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "scope", encoded = true) String scope, + @PathParam("iotAlertId") String iotAlertId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List IoT alerts. + * + * @param scope Scope of the query: Subscription (i.e. /subscriptions/{subscriptionId}) or IoT Hub (i.e. + * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Devices/iotHubs/{iotHubName}). + * @param minStartTimeUtc Filter by minimum startTimeUtc (ISO 8601 format). + * @param maxStartTimeUtc Filter by maximum startTimeUtc (ISO 8601 format). + * @param alertType Filter by alert type. + * @param deviceManagementType Get devices only from specific type, Managed or Unmanaged. + * @param compromisedEntity Filter by compromised device. + * @param limit Limit the number of items returned in a single page. + * @param skipToken Skip token used for pagination. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of IoT alerts. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String scope, + String minStartTimeUtc, + String maxStartTimeUtc, + String alertType, + ManagementState deviceManagementType, + String compromisedEntity, + Integer limit, + String skipToken) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + final String apiVersion = "2020-08-06-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + apiVersion, + scope, + minStartTimeUtc, + maxStartTimeUtc, + alertType, + deviceManagementType, + compromisedEntity, + limit, + skipToken, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List IoT alerts. + * + * @param scope Scope of the query: Subscription (i.e. /subscriptions/{subscriptionId}) or IoT Hub (i.e. + * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Devices/iotHubs/{iotHubName}). + * @param minStartTimeUtc Filter by minimum startTimeUtc (ISO 8601 format). + * @param maxStartTimeUtc Filter by maximum startTimeUtc (ISO 8601 format). + * @param alertType Filter by alert type. + * @param deviceManagementType Get devices only from specific type, Managed or Unmanaged. + * @param compromisedEntity Filter by compromised device. + * @param limit Limit the number of items returned in a single page. + * @param skipToken Skip token used for pagination. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of IoT alerts. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String scope, + String minStartTimeUtc, + String maxStartTimeUtc, + String alertType, + ManagementState deviceManagementType, + String compromisedEntity, + Integer limit, + String skipToken, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + final String apiVersion = "2020-08-06-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + apiVersion, + scope, + minStartTimeUtc, + maxStartTimeUtc, + alertType, + deviceManagementType, + compromisedEntity, + limit, + skipToken, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List IoT alerts. + * + * @param scope Scope of the query: Subscription (i.e. /subscriptions/{subscriptionId}) or IoT Hub (i.e. + * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Devices/iotHubs/{iotHubName}). + * @param minStartTimeUtc Filter by minimum startTimeUtc (ISO 8601 format). + * @param maxStartTimeUtc Filter by maximum startTimeUtc (ISO 8601 format). + * @param alertType Filter by alert type. + * @param deviceManagementType Get devices only from specific type, Managed or Unmanaged. + * @param compromisedEntity Filter by compromised device. + * @param limit Limit the number of items returned in a single page. + * @param skipToken Skip token used for pagination. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of IoT alerts. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String scope, + String minStartTimeUtc, + String maxStartTimeUtc, + String alertType, + ManagementState deviceManagementType, + String compromisedEntity, + Integer limit, + String skipToken) { + return new PagedFlux<>( + () -> + listSinglePageAsync( + scope, + minStartTimeUtc, + maxStartTimeUtc, + alertType, + deviceManagementType, + compromisedEntity, + limit, + skipToken), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List IoT alerts. + * + * @param scope Scope of the query: Subscription (i.e. /subscriptions/{subscriptionId}) or IoT Hub (i.e. + * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Devices/iotHubs/{iotHubName}). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of IoT alerts. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String scope) { + final String minStartTimeUtc = null; + final String maxStartTimeUtc = null; + final String alertType = null; + final ManagementState deviceManagementType = null; + final String compromisedEntity = null; + final Integer limit = null; + final String skipToken = null; + return new PagedFlux<>( + () -> + listSinglePageAsync( + scope, + minStartTimeUtc, + maxStartTimeUtc, + alertType, + deviceManagementType, + compromisedEntity, + limit, + skipToken), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List IoT alerts. + * + * @param scope Scope of the query: Subscription (i.e. /subscriptions/{subscriptionId}) or IoT Hub (i.e. + * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Devices/iotHubs/{iotHubName}). + * @param minStartTimeUtc Filter by minimum startTimeUtc (ISO 8601 format). + * @param maxStartTimeUtc Filter by maximum startTimeUtc (ISO 8601 format). + * @param alertType Filter by alert type. + * @param deviceManagementType Get devices only from specific type, Managed or Unmanaged. + * @param compromisedEntity Filter by compromised device. + * @param limit Limit the number of items returned in a single page. + * @param skipToken Skip token used for pagination. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of IoT alerts. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String scope, + String minStartTimeUtc, + String maxStartTimeUtc, + String alertType, + ManagementState deviceManagementType, + String compromisedEntity, + Integer limit, + String skipToken, + Context context) { + return new PagedFlux<>( + () -> + listSinglePageAsync( + scope, + minStartTimeUtc, + maxStartTimeUtc, + alertType, + deviceManagementType, + compromisedEntity, + limit, + skipToken, + context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List IoT alerts. + * + * @param scope Scope of the query: Subscription (i.e. /subscriptions/{subscriptionId}) or IoT Hub (i.e. + * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Devices/iotHubs/{iotHubName}). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of IoT alerts. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String scope) { + final String minStartTimeUtc = null; + final String maxStartTimeUtc = null; + final String alertType = null; + final ManagementState deviceManagementType = null; + final String compromisedEntity = null; + final Integer limit = null; + final String skipToken = null; + return new PagedIterable<>( + listAsync( + scope, + minStartTimeUtc, + maxStartTimeUtc, + alertType, + deviceManagementType, + compromisedEntity, + limit, + skipToken)); + } + + /** + * List IoT alerts. + * + * @param scope Scope of the query: Subscription (i.e. /subscriptions/{subscriptionId}) or IoT Hub (i.e. + * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Devices/iotHubs/{iotHubName}). + * @param minStartTimeUtc Filter by minimum startTimeUtc (ISO 8601 format). + * @param maxStartTimeUtc Filter by maximum startTimeUtc (ISO 8601 format). + * @param alertType Filter by alert type. + * @param deviceManagementType Get devices only from specific type, Managed or Unmanaged. + * @param compromisedEntity Filter by compromised device. + * @param limit Limit the number of items returned in a single page. + * @param skipToken Skip token used for pagination. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of IoT alerts. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String scope, + String minStartTimeUtc, + String maxStartTimeUtc, + String alertType, + ManagementState deviceManagementType, + String compromisedEntity, + Integer limit, + String skipToken, + Context context) { + return new PagedIterable<>( + listAsync( + scope, + minStartTimeUtc, + maxStartTimeUtc, + alertType, + deviceManagementType, + compromisedEntity, + limit, + skipToken, + context)); + } + + /** + * Get IoT alert. + * + * @param scope Scope of the query: Subscription (i.e. /subscriptions/{subscriptionId}) or IoT Hub (i.e. + * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Devices/iotHubs/{iotHubName}). + * @param iotAlertId Id of the alert. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT alert. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String scope, String iotAlertId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (iotAlertId == null) { + return Mono.error(new IllegalArgumentException("Parameter iotAlertId is required and cannot be null.")); + } + final String apiVersion = "2020-08-06-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.get(this.client.getEndpoint(), apiVersion, scope, iotAlertId, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get IoT alert. + * + * @param scope Scope of the query: Subscription (i.e. /subscriptions/{subscriptionId}) or IoT Hub (i.e. + * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Devices/iotHubs/{iotHubName}). + * @param iotAlertId Id of the alert. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT alert. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String scope, String iotAlertId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (iotAlertId == null) { + return Mono.error(new IllegalArgumentException("Parameter iotAlertId is required and cannot be null.")); + } + final String apiVersion = "2020-08-06-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), apiVersion, scope, iotAlertId, accept, context); + } + + /** + * Get IoT alert. + * + * @param scope Scope of the query: Subscription (i.e. /subscriptions/{subscriptionId}) or IoT Hub (i.e. + * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Devices/iotHubs/{iotHubName}). + * @param iotAlertId Id of the alert. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT alert. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String scope, String iotAlertId) { + return getWithResponseAsync(scope, iotAlertId) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get IoT alert. + * + * @param scope Scope of the query: Subscription (i.e. /subscriptions/{subscriptionId}) or IoT Hub (i.e. + * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Devices/iotHubs/{iotHubName}). + * @param iotAlertId Id of the alert. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT alert. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public IotAlertModelInner get(String scope, String iotAlertId) { + return getAsync(scope, iotAlertId).block(); + } + + /** + * Get IoT alert. + * + * @param scope Scope of the query: Subscription (i.e. /subscriptions/{subscriptionId}) or IoT Hub (i.e. + * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Devices/iotHubs/{iotHubName}). + * @param iotAlertId Id of the alert. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT alert. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String scope, String iotAlertId, Context context) { + return getWithResponseAsync(scope, iotAlertId, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of IoT alerts. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of IoT alerts. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotAlertsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotAlertsImpl.java new file mode 100644 index 000000000000..95150c29779e --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotAlertsImpl.java @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.IotAlertsClient; +import com.azure.resourcemanager.security.fluent.models.IotAlertModelInner; +import com.azure.resourcemanager.security.models.IotAlertModel; +import com.azure.resourcemanager.security.models.IotAlerts; +import com.azure.resourcemanager.security.models.ManagementState; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class IotAlertsImpl implements IotAlerts { + @JsonIgnore private final ClientLogger logger = new ClientLogger(IotAlertsImpl.class); + + private final IotAlertsClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public IotAlertsImpl( + IotAlertsClient innerClient, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String scope) { + PagedIterable inner = this.serviceClient().list(scope); + return Utils.mapPage(inner, inner1 -> new IotAlertModelImpl(inner1, this.manager())); + } + + public PagedIterable list( + String scope, + String minStartTimeUtc, + String maxStartTimeUtc, + String alertType, + ManagementState deviceManagementType, + String compromisedEntity, + Integer limit, + String skipToken, + Context context) { + PagedIterable inner = + this + .serviceClient() + .list( + scope, + minStartTimeUtc, + maxStartTimeUtc, + alertType, + deviceManagementType, + compromisedEntity, + limit, + skipToken, + context); + return Utils.mapPage(inner, inner1 -> new IotAlertModelImpl(inner1, this.manager())); + } + + public IotAlertModel get(String scope, String iotAlertId) { + IotAlertModelInner inner = this.serviceClient().get(scope, iotAlertId); + if (inner != null) { + return new IotAlertModelImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse(String scope, String iotAlertId, Context context) { + Response inner = this.serviceClient().getWithResponse(scope, iotAlertId, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new IotAlertModelImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private IotAlertsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotDefenderSettingsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotDefenderSettingsClientImpl.java new file mode 100644 index 000000000000..0adb99c46e36 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotDefenderSettingsClientImpl.java @@ -0,0 +1,819 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.http.rest.StreamResponse; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.IotDefenderSettingsClient; +import com.azure.resourcemanager.security.fluent.models.IotDefenderSettingsListInner; +import com.azure.resourcemanager.security.fluent.models.IotDefenderSettingsModelInner; +import com.azure.resourcemanager.security.fluent.models.PackageDownloadsInner; +import com.fasterxml.jackson.databind.util.ByteBufferBackedInputStream; +import java.io.InputStream; +import java.io.SequenceInputStream; +import java.nio.ByteBuffer; +import java.util.Enumeration; +import java.util.Iterator; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in IotDefenderSettingsClient. */ +public final class IotDefenderSettingsClientImpl implements IotDefenderSettingsClient { + private final ClientLogger logger = new ClientLogger(IotDefenderSettingsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final IotDefenderSettingsService service; + + /** The service client containing this operation class. */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of IotDefenderSettingsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + IotDefenderSettingsClientImpl(SecurityCenterImpl client) { + this.service = + RestProxy.create(IotDefenderSettingsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterIotDefenderSettings to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityCenterIotDef") + private interface IotDefenderSettingsService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/iotDefenderSettings") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/iotDefenderSettings/default") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put("/subscriptions/{subscriptionId}/providers/Microsoft.Security/iotDefenderSettings/default") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") IotDefenderSettingsModelInner iotDefenderSettingsModel, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete("/subscriptions/{subscriptionId}/providers/Microsoft.Security/iotDefenderSettings/default") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/providers/Microsoft.Security/iotDefenderSettings/default/packageDownloads") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> packageDownloads( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/providers/Microsoft.Security/iotDefenderSettings/default" + + "/downloadManagerActivation") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono downloadManagerActivation( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List IoT Defender Settings. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of IoT Defender settings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listWithResponseAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-08-06-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List IoT Defender Settings. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of IoT Defender settings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listWithResponseAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-08-06-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), accept, context); + } + + /** + * List IoT Defender Settings. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of IoT Defender settings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listAsync() { + return listWithResponseAsync() + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * List IoT Defender Settings. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of IoT Defender settings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public IotDefenderSettingsListInner list() { + return listAsync().block(); + } + + /** + * List IoT Defender Settings. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of IoT Defender settings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listWithResponse(Context context) { + return listWithResponseAsync(context).block(); + } + + /** + * Get IoT Defender Settings. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT Defender Settings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-08-06-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get IoT Defender Settings. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT Defender Settings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-08-06-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), accept, context); + } + + /** + * Get IoT Defender Settings. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT Defender Settings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync() { + return getWithResponseAsync() + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get IoT Defender Settings. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT Defender Settings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public IotDefenderSettingsModelInner get() { + return getAsync().block(); + } + + /** + * Get IoT Defender Settings. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT Defender Settings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(Context context) { + return getWithResponseAsync(context).block(); + } + + /** + * Create or update IoT Defender settings. + * + * @param iotDefenderSettingsModel The IoT defender settings model. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT Defender settings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + IotDefenderSettingsModelInner iotDefenderSettingsModel) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (iotDefenderSettingsModel == null) { + return Mono + .error( + new IllegalArgumentException("Parameter iotDefenderSettingsModel is required and cannot be null.")); + } else { + iotDefenderSettingsModel.validate(); + } + final String apiVersion = "2020-08-06-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + iotDefenderSettingsModel, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create or update IoT Defender settings. + * + * @param iotDefenderSettingsModel The IoT defender settings model. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT Defender settings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + IotDefenderSettingsModelInner iotDefenderSettingsModel, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (iotDefenderSettingsModel == null) { + return Mono + .error( + new IllegalArgumentException("Parameter iotDefenderSettingsModel is required and cannot be null.")); + } else { + iotDefenderSettingsModel.validate(); + } + final String apiVersion = "2020-08-06-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + iotDefenderSettingsModel, + accept, + context); + } + + /** + * Create or update IoT Defender settings. + * + * @param iotDefenderSettingsModel The IoT defender settings model. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT Defender settings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + IotDefenderSettingsModelInner iotDefenderSettingsModel) { + return createOrUpdateWithResponseAsync(iotDefenderSettingsModel) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Create or update IoT Defender settings. + * + * @param iotDefenderSettingsModel The IoT defender settings model. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT Defender settings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public IotDefenderSettingsModelInner createOrUpdate(IotDefenderSettingsModelInner iotDefenderSettingsModel) { + return createOrUpdateAsync(iotDefenderSettingsModel).block(); + } + + /** + * Create or update IoT Defender settings. + * + * @param iotDefenderSettingsModel The IoT defender settings model. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT Defender settings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + IotDefenderSettingsModelInner iotDefenderSettingsModel, Context context) { + return createOrUpdateWithResponseAsync(iotDefenderSettingsModel, context).block(); + } + + /** + * Delete IoT Defender settings. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-08-06-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete IoT Defender settings. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-08-06-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), accept, context); + } + + /** + * Delete IoT Defender settings. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync() { + return deleteWithResponseAsync().flatMap((Response res) -> Mono.empty()); + } + + /** + * Delete IoT Defender settings. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete() { + deleteAsync().block(); + } + + /** + * Delete IoT Defender settings. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(Context context) { + return deleteWithResponseAsync(context).block(); + } + + /** + * Information about downloadable packages. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about package downloads. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> packageDownloadsWithResponseAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-08-06-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .packageDownloads( + this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Information about downloadable packages. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about package downloads. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> packageDownloadsWithResponseAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-08-06-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .packageDownloads(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), accept, context); + } + + /** + * Information about downloadable packages. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about package downloads. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono packageDownloadsAsync() { + return packageDownloadsWithResponseAsync() + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Information about downloadable packages. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about package downloads. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PackageDownloadsInner packageDownloads() { + return packageDownloadsAsync().block(); + } + + /** + * Information about downloadable packages. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about package downloads. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response packageDownloadsWithResponse(Context context) { + return packageDownloadsWithResponseAsync(context).block(); + } + + /** + * Download manager activation data defined for this subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono downloadManagerActivationWithResponseAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-08-06-preview"; + final String accept = "application/zip"; + return FluxUtil + .withContext( + context -> + service + .downloadManagerActivation( + this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Download manager activation data defined for this subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono downloadManagerActivationWithResponseAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-08-06-preview"; + final String accept = "application/zip"; + context = this.client.mergeContext(context); + return service + .downloadManagerActivation( + this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), accept, context); + } + + /** + * Download manager activation data defined for this subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Flux downloadManagerActivationAsync() { + return downloadManagerActivationWithResponseAsync().flatMapMany(StreamResponse::getValue); + } + + /** + * Download manager activation data defined for this subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public InputStream downloadManagerActivation() { + Iterator iterator = + downloadManagerActivationAsync().map(ByteBufferBackedInputStream::new).toStream().iterator(); + Enumeration enumeration = + new Enumeration() { + @Override + public boolean hasMoreElements() { + return iterator.hasNext(); + } + + @Override + public InputStream nextElement() { + return iterator.next(); + } + }; + return new SequenceInputStream(enumeration); + } + + /** + * Download manager activation data defined for this subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public StreamResponse downloadManagerActivationWithResponse(Context context) { + return downloadManagerActivationWithResponseAsync(context).block(); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotDefenderSettingsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotDefenderSettingsImpl.java new file mode 100644 index 000000000000..506af402e27f --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotDefenderSettingsImpl.java @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.http.rest.StreamResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.IotDefenderSettingsClient; +import com.azure.resourcemanager.security.fluent.models.IotDefenderSettingsListInner; +import com.azure.resourcemanager.security.fluent.models.IotDefenderSettingsModelInner; +import com.azure.resourcemanager.security.fluent.models.PackageDownloadsInner; +import com.azure.resourcemanager.security.models.IotDefenderSettings; +import com.azure.resourcemanager.security.models.IotDefenderSettingsList; +import com.azure.resourcemanager.security.models.IotDefenderSettingsModel; +import com.azure.resourcemanager.security.models.PackageDownloads; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.io.InputStream; + +public final class IotDefenderSettingsImpl implements IotDefenderSettings { + @JsonIgnore private final ClientLogger logger = new ClientLogger(IotDefenderSettingsImpl.class); + + private final IotDefenderSettingsClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public IotDefenderSettingsImpl( + IotDefenderSettingsClient innerClient, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public IotDefenderSettingsList list() { + IotDefenderSettingsListInner inner = this.serviceClient().list(); + if (inner != null) { + return new IotDefenderSettingsListImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response listWithResponse(Context context) { + Response inner = this.serviceClient().listWithResponse(context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new IotDefenderSettingsListImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public IotDefenderSettingsModel get() { + IotDefenderSettingsModelInner inner = this.serviceClient().get(); + if (inner != null) { + return new IotDefenderSettingsModelImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse(Context context) { + Response inner = this.serviceClient().getWithResponse(context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new IotDefenderSettingsModelImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public IotDefenderSettingsModel createOrUpdate(IotDefenderSettingsModelInner iotDefenderSettingsModel) { + IotDefenderSettingsModelInner inner = this.serviceClient().createOrUpdate(iotDefenderSettingsModel); + if (inner != null) { + return new IotDefenderSettingsModelImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response createOrUpdateWithResponse( + IotDefenderSettingsModelInner iotDefenderSettingsModel, Context context) { + Response inner = + this.serviceClient().createOrUpdateWithResponse(iotDefenderSettingsModel, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new IotDefenderSettingsModelImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete() { + this.serviceClient().delete(); + } + + public Response deleteWithResponse(Context context) { + return this.serviceClient().deleteWithResponse(context); + } + + public PackageDownloads packageDownloads() { + PackageDownloadsInner inner = this.serviceClient().packageDownloads(); + if (inner != null) { + return new PackageDownloadsImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response packageDownloadsWithResponse(Context context) { + Response inner = this.serviceClient().packageDownloadsWithResponse(context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new PackageDownloadsImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public InputStream downloadManagerActivation() { + return this.serviceClient().downloadManagerActivation(); + } + + public StreamResponse downloadManagerActivationWithResponse(Context context) { + return this.serviceClient().downloadManagerActivationWithResponse(context); + } + + private IotDefenderSettingsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotDefenderSettingsListImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotDefenderSettingsListImpl.java new file mode 100644 index 000000000000..07b65d4755b7 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotDefenderSettingsListImpl.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.resourcemanager.security.fluent.models.IotDefenderSettingsListInner; +import com.azure.resourcemanager.security.fluent.models.IotDefenderSettingsModelInner; +import com.azure.resourcemanager.security.models.IotDefenderSettingsList; +import com.azure.resourcemanager.security.models.IotDefenderSettingsModel; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +public final class IotDefenderSettingsListImpl implements IotDefenderSettingsList { + private IotDefenderSettingsListInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + IotDefenderSettingsListImpl( + IotDefenderSettingsListInner innerObject, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public List value() { + List inner = this.innerModel().value(); + if (inner != null) { + return Collections + .unmodifiableList( + inner + .stream() + .map(inner1 -> new IotDefenderSettingsModelImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return Collections.emptyList(); + } + } + + public IotDefenderSettingsListInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotDefenderSettingsModelImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotDefenderSettingsModelImpl.java new file mode 100644 index 000000000000..62417551af92 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotDefenderSettingsModelImpl.java @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.resourcemanager.security.fluent.models.IotDefenderSettingsModelInner; +import com.azure.resourcemanager.security.models.IotDefenderSettingsModel; +import com.azure.resourcemanager.security.models.OnboardingKind; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; + +public final class IotDefenderSettingsModelImpl implements IotDefenderSettingsModel { + private IotDefenderSettingsModelInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + IotDefenderSettingsModelImpl( + IotDefenderSettingsModelInner innerObject, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public Integer deviceQuota() { + return this.innerModel().deviceQuota(); + } + + public List sentinelWorkspaceResourceIds() { + List inner = this.innerModel().sentinelWorkspaceResourceIds(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public OnboardingKind onboardingKind() { + return this.innerModel().onboardingKind(); + } + + public OffsetDateTime evaluationEndTime() { + return this.innerModel().evaluationEndTime(); + } + + public IotDefenderSettingsModelInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotRecommendationModelImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotRecommendationModelImpl.java new file mode 100644 index 000000000000..74ff6238816d --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotRecommendationModelImpl.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.resourcemanager.security.fluent.models.IotRecommendationModelInner; +import com.azure.resourcemanager.security.models.IotRecommendationModel; + +public final class IotRecommendationModelImpl implements IotRecommendationModel { + private IotRecommendationModelInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + IotRecommendationModelImpl( + IotRecommendationModelInner innerObject, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String deviceId() { + return this.innerModel().deviceId(); + } + + public String recommendationType() { + return this.innerModel().recommendationType(); + } + + public String discoveredTimeUtc() { + return this.innerModel().discoveredTimeUtc(); + } + + public Object recommendationAdditionalData() { + return this.innerModel().recommendationAdditionalData(); + } + + public IotRecommendationModelInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotRecommendationTypeImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotRecommendationTypeImpl.java new file mode 100644 index 000000000000..1620c9ef5537 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotRecommendationTypeImpl.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.resourcemanager.security.fluent.models.IotRecommendationTypeInner; +import com.azure.resourcemanager.security.models.IotRecommendationType; +import com.azure.resourcemanager.security.models.RecommendationSeverity; +import java.util.Collections; +import java.util.List; + +public final class IotRecommendationTypeImpl implements IotRecommendationType { + private IotRecommendationTypeInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + IotRecommendationTypeImpl( + IotRecommendationTypeInner innerObject, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String recommendationDisplayName() { + return this.innerModel().recommendationDisplayName(); + } + + public RecommendationSeverity severity() { + return this.innerModel().severity(); + } + + public String description() { + return this.innerModel().description(); + } + + public String productName() { + return this.innerModel().productName(); + } + + public String productComponentName() { + return this.innerModel().productComponentName(); + } + + public String vendorName() { + return this.innerModel().vendorName(); + } + + public String control() { + return this.innerModel().control(); + } + + public List remediationSteps() { + List inner = this.innerModel().remediationSteps(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public String dataSource() { + return this.innerModel().dataSource(); + } + + public IotRecommendationTypeInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotRecommendationTypeListImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotRecommendationTypeListImpl.java new file mode 100644 index 000000000000..b5df59664d33 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotRecommendationTypeListImpl.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.resourcemanager.security.fluent.models.IotRecommendationTypeInner; +import com.azure.resourcemanager.security.fluent.models.IotRecommendationTypeListInner; +import com.azure.resourcemanager.security.models.IotRecommendationType; +import com.azure.resourcemanager.security.models.IotRecommendationTypeList; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +public final class IotRecommendationTypeListImpl implements IotRecommendationTypeList { + private IotRecommendationTypeListInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + IotRecommendationTypeListImpl( + IotRecommendationTypeListInner innerObject, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public List value() { + List inner = this.innerModel().value(); + if (inner != null) { + return Collections + .unmodifiableList( + inner + .stream() + .map(inner1 -> new IotRecommendationTypeImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return Collections.emptyList(); + } + } + + public IotRecommendationTypeListInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotRecommendationTypesClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotRecommendationTypesClientImpl.java new file mode 100644 index 000000000000..1072304d9bca --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotRecommendationTypesClientImpl.java @@ -0,0 +1,330 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.IotRecommendationTypesClient; +import com.azure.resourcemanager.security.fluent.models.IotRecommendationTypeInner; +import com.azure.resourcemanager.security.fluent.models.IotRecommendationTypeListInner; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in IotRecommendationTypesClient. */ +public final class IotRecommendationTypesClientImpl implements IotRecommendationTypesClient { + private final ClientLogger logger = new ClientLogger(IotRecommendationTypesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final IotRecommendationTypesService service; + + /** The service client containing this operation class. */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of IotRecommendationTypesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + IotRecommendationTypesClientImpl(SecurityCenterImpl client) { + this.service = + RestProxy + .create(IotRecommendationTypesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterIotRecommendationTypes to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityCenterIotRec") + private interface IotRecommendationTypesService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/iotRecommendationTypes") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/providers/Microsoft.Security/iotRecommendationTypes" + + "/{iotRecommendationTypeName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("iotRecommendationTypeName") String iotRecommendationTypeName, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List IoT recommendation types. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of recommendation types. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listWithResponseAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-08-06-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List IoT recommendation types. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of recommendation types. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listWithResponseAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-08-06-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), accept, context); + } + + /** + * List IoT recommendation types. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of recommendation types. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listAsync() { + return listWithResponseAsync() + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * List IoT recommendation types. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of recommendation types. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public IotRecommendationTypeListInner list() { + return listAsync().block(); + } + + /** + * List IoT recommendation types. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of recommendation types. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listWithResponse(Context context) { + return listWithResponseAsync(context).block(); + } + + /** + * Get IoT recommendation type. + * + * @param iotRecommendationTypeName Name of the recommendation type. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT recommendation type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String iotRecommendationTypeName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (iotRecommendationTypeName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter iotRecommendationTypeName is required and cannot be null.")); + } + final String apiVersion = "2020-08-06-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + iotRecommendationTypeName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get IoT recommendation type. + * + * @param iotRecommendationTypeName Name of the recommendation type. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT recommendation type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String iotRecommendationTypeName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (iotRecommendationTypeName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter iotRecommendationTypeName is required and cannot be null.")); + } + final String apiVersion = "2020-08-06-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + iotRecommendationTypeName, + accept, + context); + } + + /** + * Get IoT recommendation type. + * + * @param iotRecommendationTypeName Name of the recommendation type. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT recommendation type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String iotRecommendationTypeName) { + return getWithResponseAsync(iotRecommendationTypeName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get IoT recommendation type. + * + * @param iotRecommendationTypeName Name of the recommendation type. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT recommendation type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public IotRecommendationTypeInner get(String iotRecommendationTypeName) { + return getAsync(iotRecommendationTypeName).block(); + } + + /** + * Get IoT recommendation type. + * + * @param iotRecommendationTypeName Name of the recommendation type. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT recommendation type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String iotRecommendationTypeName, Context context) { + return getWithResponseAsync(iotRecommendationTypeName, context).block(); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotRecommendationTypesImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotRecommendationTypesImpl.java new file mode 100644 index 000000000000..6954641f9605 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotRecommendationTypesImpl.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.IotRecommendationTypesClient; +import com.azure.resourcemanager.security.fluent.models.IotRecommendationTypeInner; +import com.azure.resourcemanager.security.fluent.models.IotRecommendationTypeListInner; +import com.azure.resourcemanager.security.models.IotRecommendationType; +import com.azure.resourcemanager.security.models.IotRecommendationTypeList; +import com.azure.resourcemanager.security.models.IotRecommendationTypes; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class IotRecommendationTypesImpl implements IotRecommendationTypes { + @JsonIgnore private final ClientLogger logger = new ClientLogger(IotRecommendationTypesImpl.class); + + private final IotRecommendationTypesClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public IotRecommendationTypesImpl( + IotRecommendationTypesClient innerClient, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public IotRecommendationTypeList list() { + IotRecommendationTypeListInner inner = this.serviceClient().list(); + if (inner != null) { + return new IotRecommendationTypeListImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response listWithResponse(Context context) { + Response inner = this.serviceClient().listWithResponse(context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new IotRecommendationTypeListImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public IotRecommendationType get(String iotRecommendationTypeName) { + IotRecommendationTypeInner inner = this.serviceClient().get(iotRecommendationTypeName); + if (inner != null) { + return new IotRecommendationTypeImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse(String iotRecommendationTypeName, Context context) { + Response inner = + this.serviceClient().getWithResponse(iotRecommendationTypeName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new IotRecommendationTypeImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private IotRecommendationTypesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotRecommendationsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotRecommendationsClientImpl.java new file mode 100644 index 000000000000..a18eeacf9bf8 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotRecommendationsClientImpl.java @@ -0,0 +1,509 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.IotRecommendationsClient; +import com.azure.resourcemanager.security.fluent.models.IotRecommendationModelInner; +import com.azure.resourcemanager.security.models.IotRecommendationListModel; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in IotRecommendationsClient. */ +public final class IotRecommendationsClientImpl implements IotRecommendationsClient { + private final ClientLogger logger = new ClientLogger(IotRecommendationsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final IotRecommendationsService service; + + /** The service client containing this operation class. */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of IotRecommendationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + IotRecommendationsClientImpl(SecurityCenterImpl client) { + this.service = + RestProxy.create(IotRecommendationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterIotRecommendations to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityCenterIotRec") + private interface IotRecommendationsService { + @Headers({"Content-Type: application/json"}) + @Get("/{scope}/providers/Microsoft.Security/iotRecommendations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "scope", encoded = true) String scope, + @QueryParam("recommendationType") String recommendationType, + @QueryParam("deviceId") String deviceId, + @QueryParam("$limit") Integer limit, + @QueryParam("$skipToken") String skipToken, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/{scope}/providers/Microsoft.Security/iotRecommendations/{iotRecommendationId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "scope", encoded = true) String scope, + @PathParam("iotRecommendationId") String iotRecommendationId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List IoT recommendations. + * + * @param scope Scope of the query: Subscription (i.e. /subscriptions/{subscriptionId}) or IoT Hub (i.e. + * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Devices/iotHubs/{iotHubName}). + * @param recommendationType Filter by recommendation type. + * @param deviceId Filter by device id. + * @param limit Limit the number of items returned in a single page. + * @param skipToken Skip token used for pagination. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of IoT recommendations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String scope, String recommendationType, String deviceId, Integer limit, String skipToken) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + final String apiVersion = "2020-08-06-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + apiVersion, + scope, + recommendationType, + deviceId, + limit, + skipToken, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List IoT recommendations. + * + * @param scope Scope of the query: Subscription (i.e. /subscriptions/{subscriptionId}) or IoT Hub (i.e. + * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Devices/iotHubs/{iotHubName}). + * @param recommendationType Filter by recommendation type. + * @param deviceId Filter by device id. + * @param limit Limit the number of items returned in a single page. + * @param skipToken Skip token used for pagination. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of IoT recommendations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String scope, String recommendationType, String deviceId, Integer limit, String skipToken, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + final String apiVersion = "2020-08-06-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + apiVersion, + scope, + recommendationType, + deviceId, + limit, + skipToken, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List IoT recommendations. + * + * @param scope Scope of the query: Subscription (i.e. /subscriptions/{subscriptionId}) or IoT Hub (i.e. + * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Devices/iotHubs/{iotHubName}). + * @param recommendationType Filter by recommendation type. + * @param deviceId Filter by device id. + * @param limit Limit the number of items returned in a single page. + * @param skipToken Skip token used for pagination. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of IoT recommendations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String scope, String recommendationType, String deviceId, Integer limit, String skipToken) { + return new PagedFlux<>( + () -> listSinglePageAsync(scope, recommendationType, deviceId, limit, skipToken), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List IoT recommendations. + * + * @param scope Scope of the query: Subscription (i.e. /subscriptions/{subscriptionId}) or IoT Hub (i.e. + * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Devices/iotHubs/{iotHubName}). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of IoT recommendations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String scope) { + final String recommendationType = null; + final String deviceId = null; + final Integer limit = null; + final String skipToken = null; + return new PagedFlux<>( + () -> listSinglePageAsync(scope, recommendationType, deviceId, limit, skipToken), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List IoT recommendations. + * + * @param scope Scope of the query: Subscription (i.e. /subscriptions/{subscriptionId}) or IoT Hub (i.e. + * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Devices/iotHubs/{iotHubName}). + * @param recommendationType Filter by recommendation type. + * @param deviceId Filter by device id. + * @param limit Limit the number of items returned in a single page. + * @param skipToken Skip token used for pagination. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of IoT recommendations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String scope, String recommendationType, String deviceId, Integer limit, String skipToken, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(scope, recommendationType, deviceId, limit, skipToken, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List IoT recommendations. + * + * @param scope Scope of the query: Subscription (i.e. /subscriptions/{subscriptionId}) or IoT Hub (i.e. + * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Devices/iotHubs/{iotHubName}). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of IoT recommendations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String scope) { + final String recommendationType = null; + final String deviceId = null; + final Integer limit = null; + final String skipToken = null; + return new PagedIterable<>(listAsync(scope, recommendationType, deviceId, limit, skipToken)); + } + + /** + * List IoT recommendations. + * + * @param scope Scope of the query: Subscription (i.e. /subscriptions/{subscriptionId}) or IoT Hub (i.e. + * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Devices/iotHubs/{iotHubName}). + * @param recommendationType Filter by recommendation type. + * @param deviceId Filter by device id. + * @param limit Limit the number of items returned in a single page. + * @param skipToken Skip token used for pagination. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of IoT recommendations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String scope, String recommendationType, String deviceId, Integer limit, String skipToken, Context context) { + return new PagedIterable<>(listAsync(scope, recommendationType, deviceId, limit, skipToken, context)); + } + + /** + * Get IoT recommendation. + * + * @param scope Scope of the query: Subscription (i.e. /subscriptions/{subscriptionId}) or IoT Hub (i.e. + * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Devices/iotHubs/{iotHubName}). + * @param iotRecommendationId Id of the recommendation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT recommendation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String scope, String iotRecommendationId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (iotRecommendationId == null) { + return Mono + .error(new IllegalArgumentException("Parameter iotRecommendationId is required and cannot be null.")); + } + final String apiVersion = "2020-08-06-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service.get(this.client.getEndpoint(), apiVersion, scope, iotRecommendationId, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get IoT recommendation. + * + * @param scope Scope of the query: Subscription (i.e. /subscriptions/{subscriptionId}) or IoT Hub (i.e. + * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Devices/iotHubs/{iotHubName}). + * @param iotRecommendationId Id of the recommendation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT recommendation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String scope, String iotRecommendationId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (iotRecommendationId == null) { + return Mono + .error(new IllegalArgumentException("Parameter iotRecommendationId is required and cannot be null.")); + } + final String apiVersion = "2020-08-06-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), apiVersion, scope, iotRecommendationId, accept, context); + } + + /** + * Get IoT recommendation. + * + * @param scope Scope of the query: Subscription (i.e. /subscriptions/{subscriptionId}) or IoT Hub (i.e. + * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Devices/iotHubs/{iotHubName}). + * @param iotRecommendationId Id of the recommendation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT recommendation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String scope, String iotRecommendationId) { + return getWithResponseAsync(scope, iotRecommendationId) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get IoT recommendation. + * + * @param scope Scope of the query: Subscription (i.e. /subscriptions/{subscriptionId}) or IoT Hub (i.e. + * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Devices/iotHubs/{iotHubName}). + * @param iotRecommendationId Id of the recommendation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT recommendation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public IotRecommendationModelInner get(String scope, String iotRecommendationId) { + return getAsync(scope, iotRecommendationId).block(); + } + + /** + * Get IoT recommendation. + * + * @param scope Scope of the query: Subscription (i.e. /subscriptions/{subscriptionId}) or IoT Hub (i.e. + * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Devices/iotHubs/{iotHubName}). + * @param iotRecommendationId Id of the recommendation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT recommendation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String scope, String iotRecommendationId, Context context) { + return getWithResponseAsync(scope, iotRecommendationId, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of IoT recommendations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of IoT recommendations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotRecommendationsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotRecommendationsImpl.java new file mode 100644 index 000000000000..838a95d63689 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotRecommendationsImpl.java @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.IotRecommendationsClient; +import com.azure.resourcemanager.security.fluent.models.IotRecommendationModelInner; +import com.azure.resourcemanager.security.models.IotRecommendationModel; +import com.azure.resourcemanager.security.models.IotRecommendations; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class IotRecommendationsImpl implements IotRecommendations { + @JsonIgnore private final ClientLogger logger = new ClientLogger(IotRecommendationsImpl.class); + + private final IotRecommendationsClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public IotRecommendationsImpl( + IotRecommendationsClient innerClient, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String scope) { + PagedIterable inner = this.serviceClient().list(scope); + return Utils.mapPage(inner, inner1 -> new IotRecommendationModelImpl(inner1, this.manager())); + } + + public PagedIterable list( + String scope, String recommendationType, String deviceId, Integer limit, String skipToken, Context context) { + PagedIterable inner = + this.serviceClient().list(scope, recommendationType, deviceId, limit, skipToken, context); + return Utils.mapPage(inner, inner1 -> new IotRecommendationModelImpl(inner1, this.manager())); + } + + public IotRecommendationModel get(String scope, String iotRecommendationId) { + IotRecommendationModelInner inner = this.serviceClient().get(scope, iotRecommendationId); + if (inner != null) { + return new IotRecommendationModelImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse(String scope, String iotRecommendationId, Context context) { + Response inner = + this.serviceClient().getWithResponse(scope, iotRecommendationId, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new IotRecommendationModelImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private IotRecommendationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotSecuritySolutionAnalyticsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotSecuritySolutionAnalyticsClientImpl.java new file mode 100644 index 000000000000..20c2bd135de8 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotSecuritySolutionAnalyticsClientImpl.java @@ -0,0 +1,402 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.IotSecuritySolutionAnalyticsClient; +import com.azure.resourcemanager.security.fluent.models.IoTSecuritySolutionAnalyticsModelInner; +import com.azure.resourcemanager.security.fluent.models.IoTSecuritySolutionAnalyticsModelListInner; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in IotSecuritySolutionAnalyticsClient. */ +public final class IotSecuritySolutionAnalyticsClientImpl implements IotSecuritySolutionAnalyticsClient { + private final ClientLogger logger = new ClientLogger(IotSecuritySolutionAnalyticsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final IotSecuritySolutionAnalyticsService service; + + /** The service client containing this operation class. */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of IotSecuritySolutionAnalyticsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + IotSecuritySolutionAnalyticsClientImpl(SecurityCenterImpl client) { + this.service = + RestProxy + .create( + IotSecuritySolutionAnalyticsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterIotSecuritySolutionAnalytics to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityCenterIotSec") + private interface IotSecuritySolutionAnalyticsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security" + + "/iotSecuritySolutions/{solutionName}/analyticsModels") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("solutionName") String solutionName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security" + + "/iotSecuritySolutions/{solutionName}/analyticsModels/default") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("solutionName") String solutionName, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Use this method to get IoT security Analytics metrics in an array. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param solutionName The name of the IoT Security solution. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Security analytics of your IoT Security solution. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listWithResponseAsync( + String resourceGroupName, String solutionName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (solutionName == null) { + return Mono.error(new IllegalArgumentException("Parameter solutionName is required and cannot be null.")); + } + final String apiVersion = "2019-08-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + solutionName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Use this method to get IoT security Analytics metrics in an array. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param solutionName The name of the IoT Security solution. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Security analytics of your IoT Security solution. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listWithResponseAsync( + String resourceGroupName, String solutionName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (solutionName == null) { + return Mono.error(new IllegalArgumentException("Parameter solutionName is required and cannot be null.")); + } + final String apiVersion = "2019-08-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + solutionName, + accept, + context); + } + + /** + * Use this method to get IoT security Analytics metrics in an array. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param solutionName The name of the IoT Security solution. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Security analytics of your IoT Security solution. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listAsync(String resourceGroupName, String solutionName) { + return listWithResponseAsync(resourceGroupName, solutionName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Use this method to get IoT security Analytics metrics in an array. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param solutionName The name of the IoT Security solution. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Security analytics of your IoT Security solution. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public IoTSecuritySolutionAnalyticsModelListInner list(String resourceGroupName, String solutionName) { + return listAsync(resourceGroupName, solutionName).block(); + } + + /** + * Use this method to get IoT security Analytics metrics in an array. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param solutionName The name of the IoT Security solution. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Security analytics of your IoT Security solution. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listWithResponse( + String resourceGroupName, String solutionName, Context context) { + return listWithResponseAsync(resourceGroupName, solutionName, context).block(); + } + + /** + * Use this method to get IoT Security Analytics metrics. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param solutionName The name of the IoT Security solution. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return security analytics of your IoT Security solution. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String solutionName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (solutionName == null) { + return Mono.error(new IllegalArgumentException("Parameter solutionName is required and cannot be null.")); + } + final String apiVersion = "2019-08-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + solutionName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Use this method to get IoT Security Analytics metrics. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param solutionName The name of the IoT Security solution. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return security analytics of your IoT Security solution. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String solutionName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (solutionName == null) { + return Mono.error(new IllegalArgumentException("Parameter solutionName is required and cannot be null.")); + } + final String apiVersion = "2019-08-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + solutionName, + accept, + context); + } + + /** + * Use this method to get IoT Security Analytics metrics. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param solutionName The name of the IoT Security solution. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return security analytics of your IoT Security solution. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String solutionName) { + return getWithResponseAsync(resourceGroupName, solutionName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Use this method to get IoT Security Analytics metrics. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param solutionName The name of the IoT Security solution. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return security analytics of your IoT Security solution. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public IoTSecuritySolutionAnalyticsModelInner get(String resourceGroupName, String solutionName) { + return getAsync(resourceGroupName, solutionName).block(); + } + + /** + * Use this method to get IoT Security Analytics metrics. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param solutionName The name of the IoT Security solution. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return security analytics of your IoT Security solution. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String solutionName, Context context) { + return getWithResponseAsync(resourceGroupName, solutionName, context).block(); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotSecuritySolutionAnalyticsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotSecuritySolutionAnalyticsImpl.java new file mode 100644 index 000000000000..e09e73ae81d4 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotSecuritySolutionAnalyticsImpl.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.IotSecuritySolutionAnalyticsClient; +import com.azure.resourcemanager.security.fluent.models.IoTSecuritySolutionAnalyticsModelInner; +import com.azure.resourcemanager.security.fluent.models.IoTSecuritySolutionAnalyticsModelListInner; +import com.azure.resourcemanager.security.models.IoTSecuritySolutionAnalyticsModel; +import com.azure.resourcemanager.security.models.IoTSecuritySolutionAnalyticsModelList; +import com.azure.resourcemanager.security.models.IotSecuritySolutionAnalytics; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class IotSecuritySolutionAnalyticsImpl implements IotSecuritySolutionAnalytics { + @JsonIgnore private final ClientLogger logger = new ClientLogger(IotSecuritySolutionAnalyticsImpl.class); + + private final IotSecuritySolutionAnalyticsClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public IotSecuritySolutionAnalyticsImpl( + IotSecuritySolutionAnalyticsClient innerClient, + com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public IoTSecuritySolutionAnalyticsModelList list(String resourceGroupName, String solutionName) { + IoTSecuritySolutionAnalyticsModelListInner inner = this.serviceClient().list(resourceGroupName, solutionName); + if (inner != null) { + return new IoTSecuritySolutionAnalyticsModelListImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response listWithResponse( + String resourceGroupName, String solutionName, Context context) { + Response inner = + this.serviceClient().listWithResponse(resourceGroupName, solutionName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new IoTSecuritySolutionAnalyticsModelListImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public IoTSecuritySolutionAnalyticsModel get(String resourceGroupName, String solutionName) { + IoTSecuritySolutionAnalyticsModelInner inner = this.serviceClient().get(resourceGroupName, solutionName); + if (inner != null) { + return new IoTSecuritySolutionAnalyticsModelImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String solutionName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, solutionName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new IoTSecuritySolutionAnalyticsModelImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private IotSecuritySolutionAnalyticsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotSecuritySolutionsAnalyticsAggregatedAlertsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotSecuritySolutionsAnalyticsAggregatedAlertsClientImpl.java new file mode 100644 index 000000000000..526f97fa3666 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotSecuritySolutionsAnalyticsAggregatedAlertsClientImpl.java @@ -0,0 +1,759 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.IotSecuritySolutionsAnalyticsAggregatedAlertsClient; +import com.azure.resourcemanager.security.fluent.models.IoTSecurityAggregatedAlertInner; +import com.azure.resourcemanager.security.models.IoTSecurityAggregatedAlertList; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in + * IotSecuritySolutionsAnalyticsAggregatedAlertsClient. + */ +public final class IotSecuritySolutionsAnalyticsAggregatedAlertsClientImpl + implements IotSecuritySolutionsAnalyticsAggregatedAlertsClient { + private final ClientLogger logger = new ClientLogger(IotSecuritySolutionsAnalyticsAggregatedAlertsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final IotSecuritySolutionsAnalyticsAggregatedAlertsService service; + + /** The service client containing this operation class. */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of IotSecuritySolutionsAnalyticsAggregatedAlertsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + IotSecuritySolutionsAnalyticsAggregatedAlertsClientImpl(SecurityCenterImpl client) { + this.service = + RestProxy + .create( + IotSecuritySolutionsAnalyticsAggregatedAlertsService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterIotSecuritySolutionsAnalyticsAggregatedAlerts to be + * used by the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityCenterIotSec") + private interface IotSecuritySolutionsAnalyticsAggregatedAlertsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security" + + "/iotSecuritySolutions/{solutionName}/analyticsModels/default/aggregatedAlerts") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("solutionName") String solutionName, + @QueryParam("$top") Integer top, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security" + + "/iotSecuritySolutions/{solutionName}/analyticsModels/default/aggregatedAlerts/{aggregatedAlertName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("solutionName") String solutionName, + @PathParam("aggregatedAlertName") String aggregatedAlertName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security" + + "/iotSecuritySolutions/{solutionName}/analyticsModels/default/aggregatedAlerts/{aggregatedAlertName}" + + "/dismiss") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> dismiss( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("solutionName") String solutionName, + @PathParam("aggregatedAlertName") String aggregatedAlertName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Use this method to get the aggregated alert list of yours IoT Security solution. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param solutionName The name of the IoT Security solution. + * @param top Number of results to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of IoT Security solution aggregated alert data. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, String solutionName, Integer top) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (solutionName == null) { + return Mono.error(new IllegalArgumentException("Parameter solutionName is required and cannot be null.")); + } + final String apiVersion = "2019-08-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + solutionName, + top, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Use this method to get the aggregated alert list of yours IoT Security solution. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param solutionName The name of the IoT Security solution. + * @param top Number of results to retrieve. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of IoT Security solution aggregated alert data. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, String solutionName, Integer top, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (solutionName == null) { + return Mono.error(new IllegalArgumentException("Parameter solutionName is required and cannot be null.")); + } + final String apiVersion = "2019-08-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + solutionName, + top, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Use this method to get the aggregated alert list of yours IoT Security solution. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param solutionName The name of the IoT Security solution. + * @param top Number of results to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of IoT Security solution aggregated alert data. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, String solutionName, Integer top) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, solutionName, top), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Use this method to get the aggregated alert list of yours IoT Security solution. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param solutionName The name of the IoT Security solution. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of IoT Security solution aggregated alert data. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String solutionName) { + final Integer top = null; + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, solutionName, top), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Use this method to get the aggregated alert list of yours IoT Security solution. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param solutionName The name of the IoT Security solution. + * @param top Number of results to retrieve. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of IoT Security solution aggregated alert data. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, String solutionName, Integer top, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, solutionName, top, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Use this method to get the aggregated alert list of yours IoT Security solution. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param solutionName The name of the IoT Security solution. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of IoT Security solution aggregated alert data. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String solutionName) { + final Integer top = null; + return new PagedIterable<>(listAsync(resourceGroupName, solutionName, top)); + } + + /** + * Use this method to get the aggregated alert list of yours IoT Security solution. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param solutionName The name of the IoT Security solution. + * @param top Number of results to retrieve. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of IoT Security solution aggregated alert data. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String resourceGroupName, String solutionName, Integer top, Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, solutionName, top, context)); + } + + /** + * Use this method to get a single the aggregated alert of yours IoT Security solution. This aggregation is + * performed by alert name. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param solutionName The name of the IoT Security solution. + * @param aggregatedAlertName Identifier of the aggregated alert. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return security Solution Aggregated Alert information. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String solutionName, String aggregatedAlertName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (solutionName == null) { + return Mono.error(new IllegalArgumentException("Parameter solutionName is required and cannot be null.")); + } + if (aggregatedAlertName == null) { + return Mono + .error(new IllegalArgumentException("Parameter aggregatedAlertName is required and cannot be null.")); + } + final String apiVersion = "2019-08-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + solutionName, + aggregatedAlertName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Use this method to get a single the aggregated alert of yours IoT Security solution. This aggregation is + * performed by alert name. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param solutionName The name of the IoT Security solution. + * @param aggregatedAlertName Identifier of the aggregated alert. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return security Solution Aggregated Alert information. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String solutionName, String aggregatedAlertName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (solutionName == null) { + return Mono.error(new IllegalArgumentException("Parameter solutionName is required and cannot be null.")); + } + if (aggregatedAlertName == null) { + return Mono + .error(new IllegalArgumentException("Parameter aggregatedAlertName is required and cannot be null.")); + } + final String apiVersion = "2019-08-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + solutionName, + aggregatedAlertName, + accept, + context); + } + + /** + * Use this method to get a single the aggregated alert of yours IoT Security solution. This aggregation is + * performed by alert name. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param solutionName The name of the IoT Security solution. + * @param aggregatedAlertName Identifier of the aggregated alert. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return security Solution Aggregated Alert information. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String solutionName, String aggregatedAlertName) { + return getWithResponseAsync(resourceGroupName, solutionName, aggregatedAlertName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Use this method to get a single the aggregated alert of yours IoT Security solution. This aggregation is + * performed by alert name. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param solutionName The name of the IoT Security solution. + * @param aggregatedAlertName Identifier of the aggregated alert. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return security Solution Aggregated Alert information. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public IoTSecurityAggregatedAlertInner get( + String resourceGroupName, String solutionName, String aggregatedAlertName) { + return getAsync(resourceGroupName, solutionName, aggregatedAlertName).block(); + } + + /** + * Use this method to get a single the aggregated alert of yours IoT Security solution. This aggregation is + * performed by alert name. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param solutionName The name of the IoT Security solution. + * @param aggregatedAlertName Identifier of the aggregated alert. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return security Solution Aggregated Alert information. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String solutionName, String aggregatedAlertName, Context context) { + return getWithResponseAsync(resourceGroupName, solutionName, aggregatedAlertName, context).block(); + } + + /** + * Use this method to dismiss an aggregated IoT Security Solution Alert. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param solutionName The name of the IoT Security solution. + * @param aggregatedAlertName Identifier of the aggregated alert. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> dismissWithResponseAsync( + String resourceGroupName, String solutionName, String aggregatedAlertName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (solutionName == null) { + return Mono.error(new IllegalArgumentException("Parameter solutionName is required and cannot be null.")); + } + if (aggregatedAlertName == null) { + return Mono + .error(new IllegalArgumentException("Parameter aggregatedAlertName is required and cannot be null.")); + } + final String apiVersion = "2019-08-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .dismiss( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + solutionName, + aggregatedAlertName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Use this method to dismiss an aggregated IoT Security Solution Alert. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param solutionName The name of the IoT Security solution. + * @param aggregatedAlertName Identifier of the aggregated alert. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> dismissWithResponseAsync( + String resourceGroupName, String solutionName, String aggregatedAlertName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (solutionName == null) { + return Mono.error(new IllegalArgumentException("Parameter solutionName is required and cannot be null.")); + } + if (aggregatedAlertName == null) { + return Mono + .error(new IllegalArgumentException("Parameter aggregatedAlertName is required and cannot be null.")); + } + final String apiVersion = "2019-08-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .dismiss( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + solutionName, + aggregatedAlertName, + accept, + context); + } + + /** + * Use this method to dismiss an aggregated IoT Security Solution Alert. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param solutionName The name of the IoT Security solution. + * @param aggregatedAlertName Identifier of the aggregated alert. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono dismissAsync(String resourceGroupName, String solutionName, String aggregatedAlertName) { + return dismissWithResponseAsync(resourceGroupName, solutionName, aggregatedAlertName) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Use this method to dismiss an aggregated IoT Security Solution Alert. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param solutionName The name of the IoT Security solution. + * @param aggregatedAlertName Identifier of the aggregated alert. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void dismiss(String resourceGroupName, String solutionName, String aggregatedAlertName) { + dismissAsync(resourceGroupName, solutionName, aggregatedAlertName).block(); + } + + /** + * Use this method to dismiss an aggregated IoT Security Solution Alert. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param solutionName The name of the IoT Security solution. + * @param aggregatedAlertName Identifier of the aggregated alert. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response dismissWithResponse( + String resourceGroupName, String solutionName, String aggregatedAlertName, Context context) { + return dismissWithResponseAsync(resourceGroupName, solutionName, aggregatedAlertName, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of IoT Security solution aggregated alert data. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of IoT Security solution aggregated alert data. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotSecuritySolutionsAnalyticsAggregatedAlertsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotSecuritySolutionsAnalyticsAggregatedAlertsImpl.java new file mode 100644 index 000000000000..02f5ed9adf6f --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotSecuritySolutionsAnalyticsAggregatedAlertsImpl.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.IotSecuritySolutionsAnalyticsAggregatedAlertsClient; +import com.azure.resourcemanager.security.fluent.models.IoTSecurityAggregatedAlertInner; +import com.azure.resourcemanager.security.models.IoTSecurityAggregatedAlert; +import com.azure.resourcemanager.security.models.IotSecuritySolutionsAnalyticsAggregatedAlerts; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class IotSecuritySolutionsAnalyticsAggregatedAlertsImpl + implements IotSecuritySolutionsAnalyticsAggregatedAlerts { + @JsonIgnore + private final ClientLogger logger = new ClientLogger(IotSecuritySolutionsAnalyticsAggregatedAlertsImpl.class); + + private final IotSecuritySolutionsAnalyticsAggregatedAlertsClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public IotSecuritySolutionsAnalyticsAggregatedAlertsImpl( + IotSecuritySolutionsAnalyticsAggregatedAlertsClient innerClient, + com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceGroupName, String solutionName) { + PagedIterable inner = + this.serviceClient().list(resourceGroupName, solutionName); + return Utils.mapPage(inner, inner1 -> new IoTSecurityAggregatedAlertImpl(inner1, this.manager())); + } + + public PagedIterable list( + String resourceGroupName, String solutionName, Integer top, Context context) { + PagedIterable inner = + this.serviceClient().list(resourceGroupName, solutionName, top, context); + return Utils.mapPage(inner, inner1 -> new IoTSecurityAggregatedAlertImpl(inner1, this.manager())); + } + + public IoTSecurityAggregatedAlert get(String resourceGroupName, String solutionName, String aggregatedAlertName) { + IoTSecurityAggregatedAlertInner inner = + this.serviceClient().get(resourceGroupName, solutionName, aggregatedAlertName); + if (inner != null) { + return new IoTSecurityAggregatedAlertImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String solutionName, String aggregatedAlertName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, solutionName, aggregatedAlertName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new IoTSecurityAggregatedAlertImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void dismiss(String resourceGroupName, String solutionName, String aggregatedAlertName) { + this.serviceClient().dismiss(resourceGroupName, solutionName, aggregatedAlertName); + } + + public Response dismissWithResponse( + String resourceGroupName, String solutionName, String aggregatedAlertName, Context context) { + return this.serviceClient().dismissWithResponse(resourceGroupName, solutionName, aggregatedAlertName, context); + } + + private IotSecuritySolutionsAnalyticsAggregatedAlertsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotSecuritySolutionsAnalyticsRecommendationsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotSecuritySolutionsAnalyticsRecommendationsClientImpl.java new file mode 100644 index 000000000000..e6e0fc8da63e --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotSecuritySolutionsAnalyticsRecommendationsClientImpl.java @@ -0,0 +1,584 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.IotSecuritySolutionsAnalyticsRecommendationsClient; +import com.azure.resourcemanager.security.fluent.models.IoTSecurityAggregatedRecommendationInner; +import com.azure.resourcemanager.security.models.IoTSecurityAggregatedRecommendationList; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in + * IotSecuritySolutionsAnalyticsRecommendationsClient. + */ +public final class IotSecuritySolutionsAnalyticsRecommendationsClientImpl + implements IotSecuritySolutionsAnalyticsRecommendationsClient { + private final ClientLogger logger = new ClientLogger(IotSecuritySolutionsAnalyticsRecommendationsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final IotSecuritySolutionsAnalyticsRecommendationsService service; + + /** The service client containing this operation class. */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of IotSecuritySolutionsAnalyticsRecommendationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + IotSecuritySolutionsAnalyticsRecommendationsClientImpl(SecurityCenterImpl client) { + this.service = + RestProxy + .create( + IotSecuritySolutionsAnalyticsRecommendationsService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterIotSecuritySolutionsAnalyticsRecommendations to be used + * by the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityCenterIotSec") + private interface IotSecuritySolutionsAnalyticsRecommendationsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security" + + "/iotSecuritySolutions/{solutionName}/analyticsModels/default/aggregatedRecommendations" + + "/{aggregatedRecommendationName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("solutionName") String solutionName, + @PathParam("aggregatedRecommendationName") String aggregatedRecommendationName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security" + + "/iotSecuritySolutions/{solutionName}/analyticsModels/default/aggregatedRecommendations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("solutionName") String solutionName, + @QueryParam("$top") Integer top, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Use this method to get the aggregated security analytics recommendation of yours IoT Security solution. This + * aggregation is performed by recommendation name. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param solutionName The name of the IoT Security solution. + * @param aggregatedRecommendationName Name of the recommendation aggregated for this query. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT Security solution recommendation information. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String solutionName, String aggregatedRecommendationName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (solutionName == null) { + return Mono.error(new IllegalArgumentException("Parameter solutionName is required and cannot be null.")); + } + if (aggregatedRecommendationName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter aggregatedRecommendationName is required and cannot be null.")); + } + final String apiVersion = "2019-08-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + solutionName, + aggregatedRecommendationName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Use this method to get the aggregated security analytics recommendation of yours IoT Security solution. This + * aggregation is performed by recommendation name. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param solutionName The name of the IoT Security solution. + * @param aggregatedRecommendationName Name of the recommendation aggregated for this query. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT Security solution recommendation information. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String solutionName, String aggregatedRecommendationName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (solutionName == null) { + return Mono.error(new IllegalArgumentException("Parameter solutionName is required and cannot be null.")); + } + if (aggregatedRecommendationName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter aggregatedRecommendationName is required and cannot be null.")); + } + final String apiVersion = "2019-08-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + solutionName, + aggregatedRecommendationName, + accept, + context); + } + + /** + * Use this method to get the aggregated security analytics recommendation of yours IoT Security solution. This + * aggregation is performed by recommendation name. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param solutionName The name of the IoT Security solution. + * @param aggregatedRecommendationName Name of the recommendation aggregated for this query. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT Security solution recommendation information. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String solutionName, String aggregatedRecommendationName) { + return getWithResponseAsync(resourceGroupName, solutionName, aggregatedRecommendationName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Use this method to get the aggregated security analytics recommendation of yours IoT Security solution. This + * aggregation is performed by recommendation name. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param solutionName The name of the IoT Security solution. + * @param aggregatedRecommendationName Name of the recommendation aggregated for this query. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT Security solution recommendation information. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public IoTSecurityAggregatedRecommendationInner get( + String resourceGroupName, String solutionName, String aggregatedRecommendationName) { + return getAsync(resourceGroupName, solutionName, aggregatedRecommendationName).block(); + } + + /** + * Use this method to get the aggregated security analytics recommendation of yours IoT Security solution. This + * aggregation is performed by recommendation name. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param solutionName The name of the IoT Security solution. + * @param aggregatedRecommendationName Name of the recommendation aggregated for this query. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT Security solution recommendation information. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String solutionName, String aggregatedRecommendationName, Context context) { + return getWithResponseAsync(resourceGroupName, solutionName, aggregatedRecommendationName, context).block(); + } + + /** + * Use this method to get the list of aggregated security analytics recommendations of yours IoT Security solution. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param solutionName The name of the IoT Security solution. + * @param top Number of results to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of IoT Security solution aggregated recommendations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, String solutionName, Integer top) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (solutionName == null) { + return Mono.error(new IllegalArgumentException("Parameter solutionName is required and cannot be null.")); + } + final String apiVersion = "2019-08-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + solutionName, + top, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Use this method to get the list of aggregated security analytics recommendations of yours IoT Security solution. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param solutionName The name of the IoT Security solution. + * @param top Number of results to retrieve. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of IoT Security solution aggregated recommendations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, String solutionName, Integer top, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (solutionName == null) { + return Mono.error(new IllegalArgumentException("Parameter solutionName is required and cannot be null.")); + } + final String apiVersion = "2019-08-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + solutionName, + top, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Use this method to get the list of aggregated security analytics recommendations of yours IoT Security solution. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param solutionName The name of the IoT Security solution. + * @param top Number of results to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of IoT Security solution aggregated recommendations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, String solutionName, Integer top) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, solutionName, top), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Use this method to get the list of aggregated security analytics recommendations of yours IoT Security solution. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param solutionName The name of the IoT Security solution. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of IoT Security solution aggregated recommendations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, String solutionName) { + final Integer top = null; + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, solutionName, top), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Use this method to get the list of aggregated security analytics recommendations of yours IoT Security solution. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param solutionName The name of the IoT Security solution. + * @param top Number of results to retrieve. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of IoT Security solution aggregated recommendations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, String solutionName, Integer top, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, solutionName, top, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Use this method to get the list of aggregated security analytics recommendations of yours IoT Security solution. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param solutionName The name of the IoT Security solution. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of IoT Security solution aggregated recommendations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String solutionName) { + final Integer top = null; + return new PagedIterable<>(listAsync(resourceGroupName, solutionName, top)); + } + + /** + * Use this method to get the list of aggregated security analytics recommendations of yours IoT Security solution. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param solutionName The name of the IoT Security solution. + * @param top Number of results to retrieve. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of IoT Security solution aggregated recommendations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String resourceGroupName, String solutionName, Integer top, Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, solutionName, top, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of IoT Security solution aggregated recommendations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of IoT Security solution aggregated recommendations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotSecuritySolutionsAnalyticsRecommendationsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotSecuritySolutionsAnalyticsRecommendationsImpl.java new file mode 100644 index 000000000000..78b8c1550bc7 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotSecuritySolutionsAnalyticsRecommendationsImpl.java @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.IotSecuritySolutionsAnalyticsRecommendationsClient; +import com.azure.resourcemanager.security.fluent.models.IoTSecurityAggregatedRecommendationInner; +import com.azure.resourcemanager.security.models.IoTSecurityAggregatedRecommendation; +import com.azure.resourcemanager.security.models.IotSecuritySolutionsAnalyticsRecommendations; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class IotSecuritySolutionsAnalyticsRecommendationsImpl + implements IotSecuritySolutionsAnalyticsRecommendations { + @JsonIgnore + private final ClientLogger logger = new ClientLogger(IotSecuritySolutionsAnalyticsRecommendationsImpl.class); + + private final IotSecuritySolutionsAnalyticsRecommendationsClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public IotSecuritySolutionsAnalyticsRecommendationsImpl( + IotSecuritySolutionsAnalyticsRecommendationsClient innerClient, + com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public IoTSecurityAggregatedRecommendation get( + String resourceGroupName, String solutionName, String aggregatedRecommendationName) { + IoTSecurityAggregatedRecommendationInner inner = + this.serviceClient().get(resourceGroupName, solutionName, aggregatedRecommendationName); + if (inner != null) { + return new IoTSecurityAggregatedRecommendationImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String solutionName, String aggregatedRecommendationName, Context context) { + Response inner = + this + .serviceClient() + .getWithResponse(resourceGroupName, solutionName, aggregatedRecommendationName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new IoTSecurityAggregatedRecommendationImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable list(String resourceGroupName, String solutionName) { + PagedIterable inner = + this.serviceClient().list(resourceGroupName, solutionName); + return Utils.mapPage(inner, inner1 -> new IoTSecurityAggregatedRecommendationImpl(inner1, this.manager())); + } + + public PagedIterable list( + String resourceGroupName, String solutionName, Integer top, Context context) { + PagedIterable inner = + this.serviceClient().list(resourceGroupName, solutionName, top, context); + return Utils.mapPage(inner, inner1 -> new IoTSecurityAggregatedRecommendationImpl(inner1, this.manager())); + } + + private IotSecuritySolutionsAnalyticsRecommendationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotSecuritySolutionsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotSecuritySolutionsClientImpl.java new file mode 100644 index 000000000000..7769a8fa4866 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotSecuritySolutionsClientImpl.java @@ -0,0 +1,1364 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.IotSecuritySolutionsClient; +import com.azure.resourcemanager.security.fluent.models.IoTSecuritySolutionModelInner; +import com.azure.resourcemanager.security.models.IoTSecuritySolutionsList; +import com.azure.resourcemanager.security.models.UpdateIotSecuritySolutionData; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in IotSecuritySolutionsClient. */ +public final class IotSecuritySolutionsClientImpl implements IotSecuritySolutionsClient { + private final ClientLogger logger = new ClientLogger(IotSecuritySolutionsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final IotSecuritySolutionsService service; + + /** The service client containing this operation class. */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of IotSecuritySolutionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + IotSecuritySolutionsClientImpl(SecurityCenterImpl client) { + this.service = + RestProxy + .create(IotSecuritySolutionsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterIotSecuritySolutions to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityCenterIotSec") + private interface IotSecuritySolutionsService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/iotSecuritySolutions") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("$filter") String filter, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security" + + "/iotSecuritySolutions") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("$filter") String filter, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security" + + "/iotSecuritySolutions/{solutionName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("solutionName") String solutionName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security" + + "/iotSecuritySolutions/{solutionName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("solutionName") String solutionName, + @BodyParam("application/json") IoTSecuritySolutionModelInner iotSecuritySolutionData, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security" + + "/iotSecuritySolutions/{solutionName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("solutionName") String solutionName, + @BodyParam("application/json") UpdateIotSecuritySolutionData updateIotSecuritySolutionData, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security" + + "/iotSecuritySolutions/{solutionName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("solutionName") String solutionName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Use this method to get the list of IoT Security solutions by subscription. + * + * @param filter Filter the IoT Security solution with OData syntax. Supports filtering by iotHubs. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of IoT Security solutions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String filter) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2019-08-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + filter, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Use this method to get the list of IoT Security solutions by subscription. + * + * @param filter Filter the IoT Security solution with OData syntax. Supports filtering by iotHubs. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of IoT Security solutions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String filter, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2019-08-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), filter, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Use this method to get the list of IoT Security solutions by subscription. + * + * @param filter Filter the IoT Security solution with OData syntax. Supports filtering by iotHubs. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of IoT Security solutions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String filter) { + return new PagedFlux<>( + () -> listSinglePageAsync(filter), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * Use this method to get the list of IoT Security solutions by subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of IoT Security solutions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + final String filter = null; + return new PagedFlux<>( + () -> listSinglePageAsync(filter), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * Use this method to get the list of IoT Security solutions by subscription. + * + * @param filter Filter the IoT Security solution with OData syntax. Supports filtering by iotHubs. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of IoT Security solutions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String filter, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(filter, context), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * Use this method to get the list of IoT Security solutions by subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of IoT Security solutions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + final String filter = null; + return new PagedIterable<>(listAsync(filter)); + } + + /** + * Use this method to get the list of IoT Security solutions by subscription. + * + * @param filter Filter the IoT Security solution with OData syntax. Supports filtering by iotHubs. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of IoT Security solutions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String filter, Context context) { + return new PagedIterable<>(listAsync(filter, context)); + } + + /** + * Use this method to get the list IoT Security solutions organized by resource group. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param filter Filter the IoT Security solution with OData syntax. Supports filtering by iotHubs. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of IoT Security solutions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, String filter) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String apiVersion = "2019-08-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + filter, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Use this method to get the list IoT Security solutions organized by resource group. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param filter Filter the IoT Security solution with OData syntax. Supports filtering by iotHubs. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of IoT Security solutions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, String filter, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String apiVersion = "2019-08-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + filter, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Use this method to get the list IoT Security solutions organized by resource group. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param filter Filter the IoT Security solution with OData syntax. Supports filtering by iotHubs. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of IoT Security solutions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, String filter) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, filter), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Use this method to get the list IoT Security solutions organized by resource group. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of IoT Security solutions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + final String filter = null; + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, filter), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Use this method to get the list IoT Security solutions organized by resource group. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param filter Filter the IoT Security solution with OData syntax. Supports filtering by iotHubs. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of IoT Security solutions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync( + String resourceGroupName, String filter, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, filter, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * Use this method to get the list IoT Security solutions organized by resource group. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of IoT Security solutions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + final String filter = null; + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, filter)); + } + + /** + * Use this method to get the list IoT Security solutions organized by resource group. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param filter Filter the IoT Security solution with OData syntax. Supports filtering by iotHubs. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of IoT Security solutions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup( + String resourceGroupName, String filter, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, filter, context)); + } + + /** + * User this method to get details of a specific IoT Security solution based on solution name. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param solutionName The name of the IoT Security solution. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT Security solution configuration and resource information. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String solutionName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (solutionName == null) { + return Mono.error(new IllegalArgumentException("Parameter solutionName is required and cannot be null.")); + } + final String apiVersion = "2019-08-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + solutionName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * User this method to get details of a specific IoT Security solution based on solution name. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param solutionName The name of the IoT Security solution. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT Security solution configuration and resource information. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String solutionName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (solutionName == null) { + return Mono.error(new IllegalArgumentException("Parameter solutionName is required and cannot be null.")); + } + final String apiVersion = "2019-08-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + solutionName, + accept, + context); + } + + /** + * User this method to get details of a specific IoT Security solution based on solution name. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param solutionName The name of the IoT Security solution. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT Security solution configuration and resource information. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String solutionName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, solutionName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * User this method to get details of a specific IoT Security solution based on solution name. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param solutionName The name of the IoT Security solution. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT Security solution configuration and resource information. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public IoTSecuritySolutionModelInner getByResourceGroup(String resourceGroupName, String solutionName) { + return getByResourceGroupAsync(resourceGroupName, solutionName).block(); + } + + /** + * User this method to get details of a specific IoT Security solution based on solution name. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param solutionName The name of the IoT Security solution. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT Security solution configuration and resource information. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String solutionName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, solutionName, context).block(); + } + + /** + * Use this method to create or update yours IoT Security solution. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param solutionName The name of the IoT Security solution. + * @param iotSecuritySolutionData The security solution data. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT Security solution configuration and resource information. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, String solutionName, IoTSecuritySolutionModelInner iotSecuritySolutionData) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (solutionName == null) { + return Mono.error(new IllegalArgumentException("Parameter solutionName is required and cannot be null.")); + } + if (iotSecuritySolutionData == null) { + return Mono + .error( + new IllegalArgumentException("Parameter iotSecuritySolutionData is required and cannot be null.")); + } else { + iotSecuritySolutionData.validate(); + } + final String apiVersion = "2019-08-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + solutionName, + iotSecuritySolutionData, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Use this method to create or update yours IoT Security solution. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param solutionName The name of the IoT Security solution. + * @param iotSecuritySolutionData The security solution data. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT Security solution configuration and resource information. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String solutionName, + IoTSecuritySolutionModelInner iotSecuritySolutionData, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (solutionName == null) { + return Mono.error(new IllegalArgumentException("Parameter solutionName is required and cannot be null.")); + } + if (iotSecuritySolutionData == null) { + return Mono + .error( + new IllegalArgumentException("Parameter iotSecuritySolutionData is required and cannot be null.")); + } else { + iotSecuritySolutionData.validate(); + } + final String apiVersion = "2019-08-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + solutionName, + iotSecuritySolutionData, + accept, + context); + } + + /** + * Use this method to create or update yours IoT Security solution. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param solutionName The name of the IoT Security solution. + * @param iotSecuritySolutionData The security solution data. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT Security solution configuration and resource information. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String solutionName, IoTSecuritySolutionModelInner iotSecuritySolutionData) { + return createOrUpdateWithResponseAsync(resourceGroupName, solutionName, iotSecuritySolutionData) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Use this method to create or update yours IoT Security solution. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param solutionName The name of the IoT Security solution. + * @param iotSecuritySolutionData The security solution data. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT Security solution configuration and resource information. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public IoTSecuritySolutionModelInner createOrUpdate( + String resourceGroupName, String solutionName, IoTSecuritySolutionModelInner iotSecuritySolutionData) { + return createOrUpdateAsync(resourceGroupName, solutionName, iotSecuritySolutionData).block(); + } + + /** + * Use this method to create or update yours IoT Security solution. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param solutionName The name of the IoT Security solution. + * @param iotSecuritySolutionData The security solution data. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT Security solution configuration and resource information. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, + String solutionName, + IoTSecuritySolutionModelInner iotSecuritySolutionData, + Context context) { + return createOrUpdateWithResponseAsync(resourceGroupName, solutionName, iotSecuritySolutionData, context) + .block(); + } + + /** + * Use this method to update existing IoT Security solution tags or user defined resources. To update other fields + * use the CreateOrUpdate method. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param solutionName The name of the IoT Security solution. + * @param updateIotSecuritySolutionData The security solution data. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT Security solution configuration and resource information. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String solutionName, UpdateIotSecuritySolutionData updateIotSecuritySolutionData) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (solutionName == null) { + return Mono.error(new IllegalArgumentException("Parameter solutionName is required and cannot be null.")); + } + if (updateIotSecuritySolutionData == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter updateIotSecuritySolutionData is required and cannot be null.")); + } else { + updateIotSecuritySolutionData.validate(); + } + final String apiVersion = "2019-08-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + solutionName, + updateIotSecuritySolutionData, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Use this method to update existing IoT Security solution tags or user defined resources. To update other fields + * use the CreateOrUpdate method. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param solutionName The name of the IoT Security solution. + * @param updateIotSecuritySolutionData The security solution data. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT Security solution configuration and resource information. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, + String solutionName, + UpdateIotSecuritySolutionData updateIotSecuritySolutionData, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (solutionName == null) { + return Mono.error(new IllegalArgumentException("Parameter solutionName is required and cannot be null.")); + } + if (updateIotSecuritySolutionData == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter updateIotSecuritySolutionData is required and cannot be null.")); + } else { + updateIotSecuritySolutionData.validate(); + } + final String apiVersion = "2019-08-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + solutionName, + updateIotSecuritySolutionData, + accept, + context); + } + + /** + * Use this method to update existing IoT Security solution tags or user defined resources. To update other fields + * use the CreateOrUpdate method. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param solutionName The name of the IoT Security solution. + * @param updateIotSecuritySolutionData The security solution data. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT Security solution configuration and resource information. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String solutionName, UpdateIotSecuritySolutionData updateIotSecuritySolutionData) { + return updateWithResponseAsync(resourceGroupName, solutionName, updateIotSecuritySolutionData) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Use this method to update existing IoT Security solution tags or user defined resources. To update other fields + * use the CreateOrUpdate method. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param solutionName The name of the IoT Security solution. + * @param updateIotSecuritySolutionData The security solution data. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT Security solution configuration and resource information. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public IoTSecuritySolutionModelInner update( + String resourceGroupName, String solutionName, UpdateIotSecuritySolutionData updateIotSecuritySolutionData) { + return updateAsync(resourceGroupName, solutionName, updateIotSecuritySolutionData).block(); + } + + /** + * Use this method to update existing IoT Security solution tags or user defined resources. To update other fields + * use the CreateOrUpdate method. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param solutionName The name of the IoT Security solution. + * @param updateIotSecuritySolutionData The security solution data. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT Security solution configuration and resource information. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, + String solutionName, + UpdateIotSecuritySolutionData updateIotSecuritySolutionData, + Context context) { + return updateWithResponseAsync(resourceGroupName, solutionName, updateIotSecuritySolutionData, context).block(); + } + + /** + * Use this method to delete yours IoT Security solution. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param solutionName The name of the IoT Security solution. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String solutionName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (solutionName == null) { + return Mono.error(new IllegalArgumentException("Parameter solutionName is required and cannot be null.")); + } + final String apiVersion = "2019-08-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + solutionName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Use this method to delete yours IoT Security solution. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param solutionName The name of the IoT Security solution. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, String solutionName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (solutionName == null) { + return Mono.error(new IllegalArgumentException("Parameter solutionName is required and cannot be null.")); + } + final String apiVersion = "2019-08-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + solutionName, + accept, + context); + } + + /** + * Use this method to delete yours IoT Security solution. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param solutionName The name of the IoT Security solution. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String solutionName) { + return deleteWithResponseAsync(resourceGroupName, solutionName).flatMap((Response res) -> Mono.empty()); + } + + /** + * Use this method to delete yours IoT Security solution. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param solutionName The name of the IoT Security solution. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String solutionName) { + deleteAsync(resourceGroupName, solutionName).block(); + } + + /** + * Use this method to delete yours IoT Security solution. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param solutionName The name of the IoT Security solution. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String resourceGroupName, String solutionName, Context context) { + return deleteWithResponseAsync(resourceGroupName, solutionName, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of IoT Security solutions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of IoT Security solutions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of IoT Security solutions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of IoT Security solutions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotSecuritySolutionsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotSecuritySolutionsImpl.java new file mode 100644 index 000000000000..59cdf313cd78 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotSecuritySolutionsImpl.java @@ -0,0 +1,185 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.IotSecuritySolutionsClient; +import com.azure.resourcemanager.security.fluent.models.IoTSecuritySolutionModelInner; +import com.azure.resourcemanager.security.models.IoTSecuritySolutionModel; +import com.azure.resourcemanager.security.models.IotSecuritySolutions; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class IotSecuritySolutionsImpl implements IotSecuritySolutions { + @JsonIgnore private final ClientLogger logger = new ClientLogger(IotSecuritySolutionsImpl.class); + + private final IotSecuritySolutionsClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public IotSecuritySolutionsImpl( + IotSecuritySolutionsClient innerClient, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new IoTSecuritySolutionModelImpl(inner1, this.manager())); + } + + public PagedIterable list(String filter, Context context) { + PagedIterable inner = this.serviceClient().list(filter, context); + return Utils.mapPage(inner, inner1 -> new IoTSecuritySolutionModelImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = + this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new IoTSecuritySolutionModelImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup( + String resourceGroupName, String filter, Context context) { + PagedIterable inner = + this.serviceClient().listByResourceGroup(resourceGroupName, filter, context); + return Utils.mapPage(inner, inner1 -> new IoTSecuritySolutionModelImpl(inner1, this.manager())); + } + + public IoTSecuritySolutionModel getByResourceGroup(String resourceGroupName, String solutionName) { + IoTSecuritySolutionModelInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, solutionName); + if (inner != null) { + return new IoTSecuritySolutionModelImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String solutionName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, solutionName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new IoTSecuritySolutionModelImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String solutionName) { + this.serviceClient().delete(resourceGroupName, solutionName); + } + + public Response deleteWithResponse(String resourceGroupName, String solutionName, Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, solutionName, context); + } + + public IoTSecuritySolutionModel getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String solutionName = Utils.getValueFromIdByName(id, "iotSecuritySolutions"); + if (solutionName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'iotSecuritySolutions'.", + id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, solutionName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String solutionName = Utils.getValueFromIdByName(id, "iotSecuritySolutions"); + if (solutionName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'iotSecuritySolutions'.", + id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, solutionName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String solutionName = Utils.getValueFromIdByName(id, "iotSecuritySolutions"); + if (solutionName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'iotSecuritySolutions'.", + id))); + } + this.deleteWithResponse(resourceGroupName, solutionName, Context.NONE).getValue(); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String solutionName = Utils.getValueFromIdByName(id, "iotSecuritySolutions"); + if (solutionName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'iotSecuritySolutions'.", + id))); + } + return this.deleteWithResponse(resourceGroupName, solutionName, context); + } + + private IotSecuritySolutionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } + + public IoTSecuritySolutionModelImpl define(String name) { + return new IoTSecuritySolutionModelImpl(name, this.manager()); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotSensorsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotSensorsClientImpl.java new file mode 100644 index 000000000000..edde9f94c091 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotSensorsClientImpl.java @@ -0,0 +1,1026 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.http.rest.StreamResponse; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.IotSensorsClient; +import com.azure.resourcemanager.security.fluent.models.IotSensorsListInner; +import com.azure.resourcemanager.security.fluent.models.IotSensorsModelInner; +import com.azure.resourcemanager.security.models.ResetPasswordInput; +import com.fasterxml.jackson.databind.util.ByteBufferBackedInputStream; +import java.io.InputStream; +import java.io.SequenceInputStream; +import java.nio.ByteBuffer; +import java.util.Enumeration; +import java.util.Iterator; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in IotSensorsClient. */ +public final class IotSensorsClientImpl implements IotSensorsClient { + private final ClientLogger logger = new ClientLogger(IotSensorsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final IotSensorsService service; + + /** The service client containing this operation class. */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of IotSensorsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + IotSensorsClientImpl(SecurityCenterImpl client) { + this.service = + RestProxy.create(IotSensorsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterIotSensors to be used by the proxy service to perform + * REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityCenterIotSen") + private interface IotSensorsService { + @Headers({"Content-Type: application/json"}) + @Get("/{scope}/providers/Microsoft.Security/iotSensors") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "scope", encoded = true) String scope, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/{scope}/providers/Microsoft.Security/iotSensors/{iotSensorName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "scope", encoded = true) String scope, + @PathParam("iotSensorName") String iotSensorName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put("/{scope}/providers/Microsoft.Security/iotSensors/{iotSensorName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "scope", encoded = true) String scope, + @PathParam("iotSensorName") String iotSensorName, + @BodyParam("application/json") IotSensorsModelInner iotSensorsModel, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete("/{scope}/providers/Microsoft.Security/iotSensors/{iotSensorName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "scope", encoded = true) String scope, + @PathParam("iotSensorName") String iotSensorName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post("/{scope}/providers/Microsoft.Security/iotSensors/{iotSensorName}/downloadActivation") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono downloadActivation( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "scope", encoded = true) String scope, + @PathParam("iotSensorName") String iotSensorName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post("/{scope}/providers/Microsoft.Security/iotSensors/{iotSensorName}/downloadResetPassword") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono downloadResetPassword( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "scope", encoded = true) String scope, + @PathParam("iotSensorName") String iotSensorName, + @BodyParam("application/json") ResetPasswordInput body, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post("/{scope}/providers/Microsoft.Security/iotSensors/{iotSensorName}/triggerTiPackageUpdate") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> triggerTiPackageUpdate( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "scope", encoded = true) String scope, + @PathParam("iotSensorName") String iotSensorName, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List IoT sensors. + * + * @param scope Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of IoT sensors. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listWithResponseAsync(String scope) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + final String apiVersion = "2020-08-06-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), apiVersion, scope, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List IoT sensors. + * + * @param scope Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of IoT sensors. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listWithResponseAsync(String scope, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + final String apiVersion = "2020-08-06-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.list(this.client.getEndpoint(), apiVersion, scope, accept, context); + } + + /** + * List IoT sensors. + * + * @param scope Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of IoT sensors. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listAsync(String scope) { + return listWithResponseAsync(scope) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * List IoT sensors. + * + * @param scope Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of IoT sensors. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public IotSensorsListInner list(String scope) { + return listAsync(scope).block(); + } + + /** + * List IoT sensors. + * + * @param scope Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of IoT sensors. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listWithResponse(String scope, Context context) { + return listWithResponseAsync(scope, context).block(); + } + + /** + * Get IoT sensor. + * + * @param scope Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub). + * @param iotSensorName Name of the IoT sensor. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT sensor. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String scope, String iotSensorName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (iotSensorName == null) { + return Mono.error(new IllegalArgumentException("Parameter iotSensorName is required and cannot be null.")); + } + final String apiVersion = "2020-08-06-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.get(this.client.getEndpoint(), apiVersion, scope, iotSensorName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get IoT sensor. + * + * @param scope Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub). + * @param iotSensorName Name of the IoT sensor. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT sensor. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String scope, String iotSensorName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (iotSensorName == null) { + return Mono.error(new IllegalArgumentException("Parameter iotSensorName is required and cannot be null.")); + } + final String apiVersion = "2020-08-06-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), apiVersion, scope, iotSensorName, accept, context); + } + + /** + * Get IoT sensor. + * + * @param scope Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub). + * @param iotSensorName Name of the IoT sensor. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT sensor. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String scope, String iotSensorName) { + return getWithResponseAsync(scope, iotSensorName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get IoT sensor. + * + * @param scope Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub). + * @param iotSensorName Name of the IoT sensor. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT sensor. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public IotSensorsModelInner get(String scope, String iotSensorName) { + return getAsync(scope, iotSensorName).block(); + } + + /** + * Get IoT sensor. + * + * @param scope Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub). + * @param iotSensorName Name of the IoT sensor. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT sensor. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String scope, String iotSensorName, Context context) { + return getWithResponseAsync(scope, iotSensorName, context).block(); + } + + /** + * Create or update IoT sensor. + * + * @param scope Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub). + * @param iotSensorName Name of the IoT sensor. + * @param iotSensorsModel The IoT sensor model. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT sensor model. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String scope, String iotSensorName, IotSensorsModelInner iotSensorsModel) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (iotSensorName == null) { + return Mono.error(new IllegalArgumentException("Parameter iotSensorName is required and cannot be null.")); + } + if (iotSensorsModel == null) { + return Mono + .error(new IllegalArgumentException("Parameter iotSensorsModel is required and cannot be null.")); + } else { + iotSensorsModel.validate(); + } + final String apiVersion = "2020-08-06-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + apiVersion, + scope, + iotSensorName, + iotSensorsModel, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create or update IoT sensor. + * + * @param scope Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub). + * @param iotSensorName Name of the IoT sensor. + * @param iotSensorsModel The IoT sensor model. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT sensor model. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String scope, String iotSensorName, IotSensorsModelInner iotSensorsModel, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (iotSensorName == null) { + return Mono.error(new IllegalArgumentException("Parameter iotSensorName is required and cannot be null.")); + } + if (iotSensorsModel == null) { + return Mono + .error(new IllegalArgumentException("Parameter iotSensorsModel is required and cannot be null.")); + } else { + iotSensorsModel.validate(); + } + final String apiVersion = "2020-08-06-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), apiVersion, scope, iotSensorName, iotSensorsModel, accept, context); + } + + /** + * Create or update IoT sensor. + * + * @param scope Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub). + * @param iotSensorName Name of the IoT sensor. + * @param iotSensorsModel The IoT sensor model. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT sensor model. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String scope, String iotSensorName, IotSensorsModelInner iotSensorsModel) { + return createOrUpdateWithResponseAsync(scope, iotSensorName, iotSensorsModel) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Create or update IoT sensor. + * + * @param scope Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub). + * @param iotSensorName Name of the IoT sensor. + * @param iotSensorsModel The IoT sensor model. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT sensor model. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public IotSensorsModelInner createOrUpdate( + String scope, String iotSensorName, IotSensorsModelInner iotSensorsModel) { + return createOrUpdateAsync(scope, iotSensorName, iotSensorsModel).block(); + } + + /** + * Create or update IoT sensor. + * + * @param scope Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub). + * @param iotSensorName Name of the IoT sensor. + * @param iotSensorsModel The IoT sensor model. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT sensor model. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String scope, String iotSensorName, IotSensorsModelInner iotSensorsModel, Context context) { + return createOrUpdateWithResponseAsync(scope, iotSensorName, iotSensorsModel, context).block(); + } + + /** + * Delete IoT sensor. + * + * @param scope Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub). + * @param iotSensorName Name of the IoT sensor. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String scope, String iotSensorName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (iotSensorName == null) { + return Mono.error(new IllegalArgumentException("Parameter iotSensorName is required and cannot be null.")); + } + final String apiVersion = "2020-08-06-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.delete(this.client.getEndpoint(), apiVersion, scope, iotSensorName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete IoT sensor. + * + * @param scope Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub). + * @param iotSensorName Name of the IoT sensor. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String scope, String iotSensorName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (iotSensorName == null) { + return Mono.error(new IllegalArgumentException("Parameter iotSensorName is required and cannot be null.")); + } + final String apiVersion = "2020-08-06-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), apiVersion, scope, iotSensorName, accept, context); + } + + /** + * Delete IoT sensor. + * + * @param scope Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub). + * @param iotSensorName Name of the IoT sensor. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String scope, String iotSensorName) { + return deleteWithResponseAsync(scope, iotSensorName).flatMap((Response res) -> Mono.empty()); + } + + /** + * Delete IoT sensor. + * + * @param scope Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub). + * @param iotSensorName Name of the IoT sensor. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String scope, String iotSensorName) { + deleteAsync(scope, iotSensorName).block(); + } + + /** + * Delete IoT sensor. + * + * @param scope Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub). + * @param iotSensorName Name of the IoT sensor. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String scope, String iotSensorName, Context context) { + return deleteWithResponseAsync(scope, iotSensorName, context).block(); + } + + /** + * Download sensor activation file. + * + * @param scope Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub). + * @param iotSensorName Name of the IoT sensor. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono downloadActivationWithResponseAsync(String scope, String iotSensorName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (iotSensorName == null) { + return Mono.error(new IllegalArgumentException("Parameter iotSensorName is required and cannot be null.")); + } + final String apiVersion = "2020-08-06-preview"; + final String accept = "application/zip"; + return FluxUtil + .withContext( + context -> + service + .downloadActivation( + this.client.getEndpoint(), apiVersion, scope, iotSensorName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Download sensor activation file. + * + * @param scope Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub). + * @param iotSensorName Name of the IoT sensor. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono downloadActivationWithResponseAsync( + String scope, String iotSensorName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (iotSensorName == null) { + return Mono.error(new IllegalArgumentException("Parameter iotSensorName is required and cannot be null.")); + } + final String apiVersion = "2020-08-06-preview"; + final String accept = "application/zip"; + context = this.client.mergeContext(context); + return service.downloadActivation(this.client.getEndpoint(), apiVersion, scope, iotSensorName, accept, context); + } + + /** + * Download sensor activation file. + * + * @param scope Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub). + * @param iotSensorName Name of the IoT sensor. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Flux downloadActivationAsync(String scope, String iotSensorName) { + return downloadActivationWithResponseAsync(scope, iotSensorName).flatMapMany(StreamResponse::getValue); + } + + /** + * Download sensor activation file. + * + * @param scope Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub). + * @param iotSensorName Name of the IoT sensor. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public InputStream downloadActivation(String scope, String iotSensorName) { + Iterator iterator = + downloadActivationAsync(scope, iotSensorName).map(ByteBufferBackedInputStream::new).toStream().iterator(); + Enumeration enumeration = + new Enumeration() { + @Override + public boolean hasMoreElements() { + return iterator.hasNext(); + } + + @Override + public InputStream nextElement() { + return iterator.next(); + } + }; + return new SequenceInputStream(enumeration); + } + + /** + * Download sensor activation file. + * + * @param scope Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub). + * @param iotSensorName Name of the IoT sensor. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public StreamResponse downloadActivationWithResponse(String scope, String iotSensorName, Context context) { + return downloadActivationWithResponseAsync(scope, iotSensorName, context).block(); + } + + /** + * Download file for reset password of the sensor. + * + * @param scope Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub). + * @param iotSensorName Name of the IoT sensor. + * @param body The reset password input. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono downloadResetPasswordWithResponseAsync( + String scope, String iotSensorName, ResetPasswordInput body) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (iotSensorName == null) { + return Mono.error(new IllegalArgumentException("Parameter iotSensorName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String apiVersion = "2020-08-06-preview"; + final String accept = "application/zip"; + return FluxUtil + .withContext( + context -> + service + .downloadResetPassword( + this.client.getEndpoint(), apiVersion, scope, iotSensorName, body, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Download file for reset password of the sensor. + * + * @param scope Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub). + * @param iotSensorName Name of the IoT sensor. + * @param body The reset password input. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono downloadResetPasswordWithResponseAsync( + String scope, String iotSensorName, ResetPasswordInput body, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (iotSensorName == null) { + return Mono.error(new IllegalArgumentException("Parameter iotSensorName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String apiVersion = "2020-08-06-preview"; + final String accept = "application/zip"; + context = this.client.mergeContext(context); + return service + .downloadResetPassword(this.client.getEndpoint(), apiVersion, scope, iotSensorName, body, accept, context); + } + + /** + * Download file for reset password of the sensor. + * + * @param scope Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub). + * @param iotSensorName Name of the IoT sensor. + * @param body The reset password input. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Flux downloadResetPasswordAsync(String scope, String iotSensorName, ResetPasswordInput body) { + return downloadResetPasswordWithResponseAsync(scope, iotSensorName, body).flatMapMany(StreamResponse::getValue); + } + + /** + * Download file for reset password of the sensor. + * + * @param scope Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub). + * @param iotSensorName Name of the IoT sensor. + * @param body The reset password input. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public InputStream downloadResetPassword(String scope, String iotSensorName, ResetPasswordInput body) { + Iterator iterator = + downloadResetPasswordAsync(scope, iotSensorName, body) + .map(ByteBufferBackedInputStream::new) + .toStream() + .iterator(); + Enumeration enumeration = + new Enumeration() { + @Override + public boolean hasMoreElements() { + return iterator.hasNext(); + } + + @Override + public InputStream nextElement() { + return iterator.next(); + } + }; + return new SequenceInputStream(enumeration); + } + + /** + * Download file for reset password of the sensor. + * + * @param scope Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub). + * @param iotSensorName Name of the IoT sensor. + * @param body The reset password input. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public StreamResponse downloadResetPasswordWithResponse( + String scope, String iotSensorName, ResetPasswordInput body, Context context) { + return downloadResetPasswordWithResponseAsync(scope, iotSensorName, body, context).block(); + } + + /** + * Trigger threat intelligence package update. + * + * @param scope Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub). + * @param iotSensorName Name of the IoT sensor. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> triggerTiPackageUpdateWithResponseAsync(String scope, String iotSensorName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (iotSensorName == null) { + return Mono.error(new IllegalArgumentException("Parameter iotSensorName is required and cannot be null.")); + } + final String apiVersion = "2020-08-06-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .triggerTiPackageUpdate( + this.client.getEndpoint(), apiVersion, scope, iotSensorName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Trigger threat intelligence package update. + * + * @param scope Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub). + * @param iotSensorName Name of the IoT sensor. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> triggerTiPackageUpdateWithResponseAsync( + String scope, String iotSensorName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (iotSensorName == null) { + return Mono.error(new IllegalArgumentException("Parameter iotSensorName is required and cannot be null.")); + } + final String apiVersion = "2020-08-06-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .triggerTiPackageUpdate(this.client.getEndpoint(), apiVersion, scope, iotSensorName, accept, context); + } + + /** + * Trigger threat intelligence package update. + * + * @param scope Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub). + * @param iotSensorName Name of the IoT sensor. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono triggerTiPackageUpdateAsync(String scope, String iotSensorName) { + return triggerTiPackageUpdateWithResponseAsync(scope, iotSensorName) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Trigger threat intelligence package update. + * + * @param scope Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub). + * @param iotSensorName Name of the IoT sensor. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void triggerTiPackageUpdate(String scope, String iotSensorName) { + triggerTiPackageUpdateAsync(scope, iotSensorName).block(); + } + + /** + * Trigger threat intelligence package update. + * + * @param scope Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub). + * @param iotSensorName Name of the IoT sensor. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response triggerTiPackageUpdateWithResponse(String scope, String iotSensorName, Context context) { + return triggerTiPackageUpdateWithResponseAsync(scope, iotSensorName, context).block(); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotSensorsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotSensorsImpl.java new file mode 100644 index 000000000000..73997c7903a5 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotSensorsImpl.java @@ -0,0 +1,219 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.http.rest.StreamResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.IotSensorsClient; +import com.azure.resourcemanager.security.fluent.models.IotSensorsListInner; +import com.azure.resourcemanager.security.fluent.models.IotSensorsModelInner; +import com.azure.resourcemanager.security.models.IotSensors; +import com.azure.resourcemanager.security.models.IotSensorsList; +import com.azure.resourcemanager.security.models.IotSensorsModel; +import com.azure.resourcemanager.security.models.ResetPasswordInput; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.io.InputStream; + +public final class IotSensorsImpl implements IotSensors { + @JsonIgnore private final ClientLogger logger = new ClientLogger(IotSensorsImpl.class); + + private final IotSensorsClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public IotSensorsImpl( + IotSensorsClient innerClient, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public IotSensorsList list(String scope) { + IotSensorsListInner inner = this.serviceClient().list(scope); + if (inner != null) { + return new IotSensorsListImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response listWithResponse(String scope, Context context) { + Response inner = this.serviceClient().listWithResponse(scope, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new IotSensorsListImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public IotSensorsModel get(String scope, String iotSensorName) { + IotSensorsModelInner inner = this.serviceClient().get(scope, iotSensorName); + if (inner != null) { + return new IotSensorsModelImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse(String scope, String iotSensorName, Context context) { + Response inner = this.serviceClient().getWithResponse(scope, iotSensorName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new IotSensorsModelImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deleteByResourceGroup(String scope, String iotSensorName) { + this.serviceClient().delete(scope, iotSensorName); + } + + public Response deleteWithResponse(String scope, String iotSensorName, Context context) { + return this.serviceClient().deleteWithResponse(scope, iotSensorName, context); + } + + public InputStream downloadActivation(String scope, String iotSensorName) { + return this.serviceClient().downloadActivation(scope, iotSensorName); + } + + public StreamResponse downloadActivationWithResponse(String scope, String iotSensorName, Context context) { + return this.serviceClient().downloadActivationWithResponse(scope, iotSensorName, context); + } + + public InputStream downloadResetPassword(String scope, String iotSensorName, ResetPasswordInput body) { + return this.serviceClient().downloadResetPassword(scope, iotSensorName, body); + } + + public StreamResponse downloadResetPasswordWithResponse( + String scope, String iotSensorName, ResetPasswordInput body, Context context) { + return this.serviceClient().downloadResetPasswordWithResponse(scope, iotSensorName, body, context); + } + + public void triggerTiPackageUpdate(String scope, String iotSensorName) { + this.serviceClient().triggerTiPackageUpdate(scope, iotSensorName); + } + + public Response triggerTiPackageUpdateWithResponse(String scope, String iotSensorName, Context context) { + return this.serviceClient().triggerTiPackageUpdateWithResponse(scope, iotSensorName, context); + } + + public IotSensorsModel getById(String id) { + String scope = + Utils + .getValueFromIdByParameterName( + id, "/{scope}/providers/Microsoft.Security/iotSensors/{iotSensorName}", "scope"); + if (scope == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'scope'.", id))); + } + String iotSensorName = + Utils + .getValueFromIdByParameterName( + id, "/{scope}/providers/Microsoft.Security/iotSensors/{iotSensorName}", "iotSensorName"); + if (iotSensorName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'iotSensors'.", id))); + } + return this.getWithResponse(scope, iotSensorName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String scope = + Utils + .getValueFromIdByParameterName( + id, "/{scope}/providers/Microsoft.Security/iotSensors/{iotSensorName}", "scope"); + if (scope == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'scope'.", id))); + } + String iotSensorName = + Utils + .getValueFromIdByParameterName( + id, "/{scope}/providers/Microsoft.Security/iotSensors/{iotSensorName}", "iotSensorName"); + if (iotSensorName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'iotSensors'.", id))); + } + return this.getWithResponse(scope, iotSensorName, context); + } + + public void deleteById(String id) { + String scope = + Utils + .getValueFromIdByParameterName( + id, "/{scope}/providers/Microsoft.Security/iotSensors/{iotSensorName}", "scope"); + if (scope == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'scope'.", id))); + } + String iotSensorName = + Utils + .getValueFromIdByParameterName( + id, "/{scope}/providers/Microsoft.Security/iotSensors/{iotSensorName}", "iotSensorName"); + if (iotSensorName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'iotSensors'.", id))); + } + this.deleteWithResponse(scope, iotSensorName, Context.NONE).getValue(); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String scope = + Utils + .getValueFromIdByParameterName( + id, "/{scope}/providers/Microsoft.Security/iotSensors/{iotSensorName}", "scope"); + if (scope == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'scope'.", id))); + } + String iotSensorName = + Utils + .getValueFromIdByParameterName( + id, "/{scope}/providers/Microsoft.Security/iotSensors/{iotSensorName}", "iotSensorName"); + if (iotSensorName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'iotSensors'.", id))); + } + return this.deleteWithResponse(scope, iotSensorName, context); + } + + private IotSensorsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } + + public IotSensorsModelImpl define(String name) { + return new IotSensorsModelImpl(name, this.manager()); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotSensorsListImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotSensorsListImpl.java new file mode 100644 index 000000000000..dffae09845d2 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotSensorsListImpl.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.resourcemanager.security.fluent.models.IotSensorsListInner; +import com.azure.resourcemanager.security.fluent.models.IotSensorsModelInner; +import com.azure.resourcemanager.security.models.IotSensorsList; +import com.azure.resourcemanager.security.models.IotSensorsModel; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +public final class IotSensorsListImpl implements IotSensorsList { + private IotSensorsListInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + IotSensorsListImpl( + IotSensorsListInner innerObject, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public List value() { + List inner = this.innerModel().value(); + if (inner != null) { + return Collections + .unmodifiableList( + inner + .stream() + .map(inner1 -> new IotSensorsModelImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return Collections.emptyList(); + } + } + + public IotSensorsListInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotSensorsModelImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotSensorsModelImpl.java new file mode 100644 index 000000000000..75cbf9d345a2 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotSensorsModelImpl.java @@ -0,0 +1,216 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.StreamResponse; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.IotSensorsModelInner; +import com.azure.resourcemanager.security.models.IotSensorsModel; +import com.azure.resourcemanager.security.models.ResetPasswordInput; +import com.azure.resourcemanager.security.models.SensorStatus; +import com.azure.resourcemanager.security.models.SensorType; +import com.azure.resourcemanager.security.models.TiStatus; +import java.io.InputStream; + +public final class IotSensorsModelImpl implements IotSensorsModel, IotSensorsModel.Definition, IotSensorsModel.Update { + private IotSensorsModelInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String connectivityTime() { + return this.innerModel().connectivityTime(); + } + + public String creationTime() { + return this.innerModel().creationTime(); + } + + public Boolean dynamicLearning() { + return this.innerModel().dynamicLearning(); + } + + public Boolean learningMode() { + return this.innerModel().learningMode(); + } + + public SensorStatus sensorStatus() { + return this.innerModel().sensorStatus(); + } + + public String sensorVersion() { + return this.innerModel().sensorVersion(); + } + + public Boolean tiAutomaticUpdates() { + return this.innerModel().tiAutomaticUpdates(); + } + + public TiStatus tiStatus() { + return this.innerModel().tiStatus(); + } + + public String tiVersion() { + return this.innerModel().tiVersion(); + } + + public String zone() { + return this.innerModel().zone(); + } + + public SensorType sensorType() { + return this.innerModel().sensorType(); + } + + public IotSensorsModelInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } + + private String scope; + + private String iotSensorName; + + public IotSensorsModelImpl withExistingScope(String scope) { + this.scope = scope; + return this; + } + + public IotSensorsModel create() { + this.innerObject = + serviceManager + .serviceClient() + .getIotSensors() + .createOrUpdateWithResponse(scope, iotSensorName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public IotSensorsModel create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getIotSensors() + .createOrUpdateWithResponse(scope, iotSensorName, this.innerModel(), context) + .getValue(); + return this; + } + + IotSensorsModelImpl(String name, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = new IotSensorsModelInner(); + this.serviceManager = serviceManager; + this.iotSensorName = name; + } + + public IotSensorsModelImpl update() { + return this; + } + + public IotSensorsModel apply() { + this.innerObject = + serviceManager + .serviceClient() + .getIotSensors() + .createOrUpdateWithResponse(scope, iotSensorName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public IotSensorsModel apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getIotSensors() + .createOrUpdateWithResponse(scope, iotSensorName, this.innerModel(), context) + .getValue(); + return this; + } + + IotSensorsModelImpl( + IotSensorsModelInner innerObject, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.scope = + Utils + .getValueFromIdByParameterName( + innerObject.id(), "/{scope}/providers/Microsoft.Security/iotSensors/{iotSensorName}", "scope"); + this.iotSensorName = + Utils + .getValueFromIdByParameterName( + innerObject.id(), + "/{scope}/providers/Microsoft.Security/iotSensors/{iotSensorName}", + "iotSensorName"); + } + + public IotSensorsModel refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getIotSensors() + .getWithResponse(scope, iotSensorName, Context.NONE) + .getValue(); + return this; + } + + public IotSensorsModel refresh(Context context) { + this.innerObject = + serviceManager.serviceClient().getIotSensors().getWithResponse(scope, iotSensorName, context).getValue(); + return this; + } + + public InputStream downloadActivation() { + return serviceManager.iotSensors().downloadActivation(scope, iotSensorName); + } + + public StreamResponse downloadActivationWithResponse(Context context) { + return serviceManager.iotSensors().downloadActivationWithResponse(scope, iotSensorName, context); + } + + public InputStream downloadResetPassword(ResetPasswordInput body) { + return serviceManager.iotSensors().downloadResetPassword(scope, iotSensorName, body); + } + + public StreamResponse downloadResetPasswordWithResponse(ResetPasswordInput body, Context context) { + return serviceManager.iotSensors().downloadResetPasswordWithResponse(scope, iotSensorName, body, context); + } + + public void triggerTiPackageUpdate() { + serviceManager.iotSensors().triggerTiPackageUpdate(scope, iotSensorName); + } + + public Response triggerTiPackageUpdateWithResponse(Context context) { + return serviceManager.iotSensors().triggerTiPackageUpdateWithResponse(scope, iotSensorName, context); + } + + public IotSensorsModelImpl withTiAutomaticUpdates(Boolean tiAutomaticUpdates) { + this.innerModel().withTiAutomaticUpdates(tiAutomaticUpdates); + return this; + } + + public IotSensorsModelImpl withZone(String zone) { + this.innerModel().withZone(zone); + return this; + } + + public IotSensorsModelImpl withSensorType(SensorType sensorType) { + this.innerModel().withSensorType(sensorType); + return this; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotSitesClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotSitesClientImpl.java new file mode 100644 index 000000000000..47c040539e41 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotSitesClientImpl.java @@ -0,0 +1,537 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.IotSitesClient; +import com.azure.resourcemanager.security.fluent.models.IotSitesListInner; +import com.azure.resourcemanager.security.fluent.models.IotSitesModelInner; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in IotSitesClient. */ +public final class IotSitesClientImpl implements IotSitesClient { + private final ClientLogger logger = new ClientLogger(IotSitesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final IotSitesService service; + + /** The service client containing this operation class. */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of IotSitesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + IotSitesClientImpl(SecurityCenterImpl client) { + this.service = RestProxy.create(IotSitesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterIotSites to be used by the proxy service to perform + * REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityCenterIotSit") + private interface IotSitesService { + @Headers({"Content-Type: application/json"}) + @Get("/{scope}/providers/Microsoft.Security/iotSites") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "scope", encoded = true) String scope, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/{scope}/providers/Microsoft.Security/iotSites/default") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "scope", encoded = true) String scope, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put("/{scope}/providers/Microsoft.Security/iotSites/default") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "scope", encoded = true) String scope, + @BodyParam("application/json") IotSitesModelInner iotSitesModel, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete("/{scope}/providers/Microsoft.Security/iotSites/default") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "scope", encoded = true) String scope, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List IoT sites. + * + * @param scope Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of IoT sites. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listWithResponseAsync(String scope) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + final String apiVersion = "2020-08-06-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), apiVersion, scope, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List IoT sites. + * + * @param scope Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of IoT sites. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listWithResponseAsync(String scope, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + final String apiVersion = "2020-08-06-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.list(this.client.getEndpoint(), apiVersion, scope, accept, context); + } + + /** + * List IoT sites. + * + * @param scope Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of IoT sites. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listAsync(String scope) { + return listWithResponseAsync(scope) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * List IoT sites. + * + * @param scope Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of IoT sites. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public IotSitesListInner list(String scope) { + return listAsync(scope).block(); + } + + /** + * List IoT sites. + * + * @param scope Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of IoT sites. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listWithResponse(String scope, Context context) { + return listWithResponseAsync(scope, context).block(); + } + + /** + * Get IoT site. + * + * @param scope Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT site. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String scope) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + final String apiVersion = "2020-08-06-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), apiVersion, scope, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get IoT site. + * + * @param scope Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT site. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String scope, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + final String apiVersion = "2020-08-06-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), apiVersion, scope, accept, context); + } + + /** + * Get IoT site. + * + * @param scope Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT site. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String scope) { + return getWithResponseAsync(scope) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get IoT site. + * + * @param scope Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT site. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public IotSitesModelInner get(String scope) { + return getAsync(scope).block(); + } + + /** + * Get IoT site. + * + * @param scope Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT site. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String scope, Context context) { + return getWithResponseAsync(scope, context).block(); + } + + /** + * Create or update IoT site. + * + * @param scope Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub). + * @param iotSitesModel The IoT sites model. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT site model. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String scope, IotSitesModelInner iotSitesModel) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (iotSitesModel == null) { + return Mono.error(new IllegalArgumentException("Parameter iotSitesModel is required and cannot be null.")); + } else { + iotSitesModel.validate(); + } + final String apiVersion = "2020-08-06-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate(this.client.getEndpoint(), apiVersion, scope, iotSitesModel, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create or update IoT site. + * + * @param scope Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub). + * @param iotSitesModel The IoT sites model. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT site model. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String scope, IotSitesModelInner iotSitesModel, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (iotSitesModel == null) { + return Mono.error(new IllegalArgumentException("Parameter iotSitesModel is required and cannot be null.")); + } else { + iotSitesModel.validate(); + } + final String apiVersion = "2020-08-06-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.createOrUpdate(this.client.getEndpoint(), apiVersion, scope, iotSitesModel, accept, context); + } + + /** + * Create or update IoT site. + * + * @param scope Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub). + * @param iotSitesModel The IoT sites model. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT site model. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String scope, IotSitesModelInner iotSitesModel) { + return createOrUpdateWithResponseAsync(scope, iotSitesModel) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Create or update IoT site. + * + * @param scope Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub). + * @param iotSitesModel The IoT sites model. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT site model. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public IotSitesModelInner createOrUpdate(String scope, IotSitesModelInner iotSitesModel) { + return createOrUpdateAsync(scope, iotSitesModel).block(); + } + + /** + * Create or update IoT site. + * + * @param scope Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub). + * @param iotSitesModel The IoT sites model. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT site model. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String scope, IotSitesModelInner iotSitesModel, Context context) { + return createOrUpdateWithResponseAsync(scope, iotSitesModel, context).block(); + } + + /** + * Delete IoT site. + * + * @param scope Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String scope) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + final String apiVersion = "2020-08-06-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), apiVersion, scope, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete IoT site. + * + * @param scope Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String scope, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + final String apiVersion = "2020-08-06-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), apiVersion, scope, accept, context); + } + + /** + * Delete IoT site. + * + * @param scope Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String scope) { + return deleteWithResponseAsync(scope).flatMap((Response res) -> Mono.empty()); + } + + /** + * Delete IoT site. + * + * @param scope Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String scope) { + deleteAsync(scope).block(); + } + + /** + * Delete IoT site. + * + * @param scope Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String scope, Context context) { + return deleteWithResponseAsync(scope, context).block(); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotSitesImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotSitesImpl.java new file mode 100644 index 000000000000..4b705e75ad66 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotSitesImpl.java @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.IotSitesClient; +import com.azure.resourcemanager.security.fluent.models.IotSitesListInner; +import com.azure.resourcemanager.security.fluent.models.IotSitesModelInner; +import com.azure.resourcemanager.security.models.IotSites; +import com.azure.resourcemanager.security.models.IotSitesList; +import com.azure.resourcemanager.security.models.IotSitesModel; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class IotSitesImpl implements IotSites { + @JsonIgnore private final ClientLogger logger = new ClientLogger(IotSitesImpl.class); + + private final IotSitesClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public IotSitesImpl(IotSitesClient innerClient, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public IotSitesList list(String scope) { + IotSitesListInner inner = this.serviceClient().list(scope); + if (inner != null) { + return new IotSitesListImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response listWithResponse(String scope, Context context) { + Response inner = this.serviceClient().listWithResponse(scope, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new IotSitesListImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public IotSitesModel get(String scope) { + IotSitesModelInner inner = this.serviceClient().get(scope); + if (inner != null) { + return new IotSitesModelImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse(String scope, Context context) { + Response inner = this.serviceClient().getWithResponse(scope, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new IotSitesModelImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public IotSitesModel createOrUpdate(String scope, IotSitesModelInner iotSitesModel) { + IotSitesModelInner inner = this.serviceClient().createOrUpdate(scope, iotSitesModel); + if (inner != null) { + return new IotSitesModelImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response createOrUpdateWithResponse( + String scope, IotSitesModelInner iotSitesModel, Context context) { + Response inner = + this.serviceClient().createOrUpdateWithResponse(scope, iotSitesModel, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new IotSitesModelImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String scope) { + this.serviceClient().delete(scope); + } + + public Response deleteWithResponse(String scope, Context context) { + return this.serviceClient().deleteWithResponse(scope, context); + } + + private IotSitesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotSitesListImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotSitesListImpl.java new file mode 100644 index 000000000000..a4c09713ae5f --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotSitesListImpl.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.resourcemanager.security.fluent.models.IotSitesListInner; +import com.azure.resourcemanager.security.fluent.models.IotSitesModelInner; +import com.azure.resourcemanager.security.models.IotSitesList; +import com.azure.resourcemanager.security.models.IotSitesModel; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +public final class IotSitesListImpl implements IotSitesList { + private IotSitesListInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + IotSitesListImpl(IotSitesListInner innerObject, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public List value() { + List inner = this.innerModel().value(); + if (inner != null) { + return Collections + .unmodifiableList( + inner + .stream() + .map(inner1 -> new IotSitesModelImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return Collections.emptyList(); + } + } + + public IotSitesListInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotSitesModelImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotSitesModelImpl.java new file mode 100644 index 000000000000..93d7305087cd --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotSitesModelImpl.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.resourcemanager.security.fluent.models.IotSitesModelInner; +import com.azure.resourcemanager.security.models.IotSitesModel; +import java.util.Collections; +import java.util.Map; + +public final class IotSitesModelImpl implements IotSitesModel { + private IotSitesModelInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + IotSitesModelImpl( + IotSitesModelInner innerObject, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String displayName() { + return this.innerModel().displayName(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public IotSitesModelInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/JitNetworkAccessPoliciesClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/JitNetworkAccessPoliciesClientImpl.java new file mode 100644 index 000000000000..4038535a6bcc --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/JitNetworkAccessPoliciesClientImpl.java @@ -0,0 +1,1978 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.JitNetworkAccessPoliciesClient; +import com.azure.resourcemanager.security.fluent.models.JitNetworkAccessPolicyInner; +import com.azure.resourcemanager.security.fluent.models.JitNetworkAccessRequestInner; +import com.azure.resourcemanager.security.models.JitNetworkAccessPoliciesList; +import com.azure.resourcemanager.security.models.JitNetworkAccessPolicyInitiateRequest; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in JitNetworkAccessPoliciesClient. */ +public final class JitNetworkAccessPoliciesClientImpl implements JitNetworkAccessPoliciesClient { + private final ClientLogger logger = new ClientLogger(JitNetworkAccessPoliciesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final JitNetworkAccessPoliciesService service; + + /** The service client containing this operation class. */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of JitNetworkAccessPoliciesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + JitNetworkAccessPoliciesClientImpl(SecurityCenterImpl client) { + this.service = + RestProxy + .create(JitNetworkAccessPoliciesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterJitNetworkAccessPolicies to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityCenterJitNet") + private interface JitNetworkAccessPoliciesService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/jitNetworkAccessPolicies") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}" + + "/jitNetworkAccessPolicies") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByRegion( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("ascLocation") String ascLocation, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security" + + "/jitNetworkAccessPolicies") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations" + + "/{ascLocation}/jitNetworkAccessPolicies") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupAndRegion( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("ascLocation") String ascLocation, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations" + + "/{ascLocation}/jitNetworkAccessPolicies/{jitNetworkAccessPolicyName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("ascLocation") String ascLocation, + @PathParam("jitNetworkAccessPolicyName") String jitNetworkAccessPolicyName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations" + + "/{ascLocation}/jitNetworkAccessPolicies/{jitNetworkAccessPolicyName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("ascLocation") String ascLocation, + @PathParam("jitNetworkAccessPolicyName") String jitNetworkAccessPolicyName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") JitNetworkAccessPolicyInner body, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations" + + "/{ascLocation}/jitNetworkAccessPolicies/{jitNetworkAccessPolicyName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("ascLocation") String ascLocation, + @PathParam("jitNetworkAccessPolicyName") String jitNetworkAccessPolicyName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations" + + "/{ascLocation}/jitNetworkAccessPolicies/{jitNetworkAccessPolicyName}" + + "/{jitNetworkAccessPolicyInitiateType}") + @ExpectedResponses({202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> initiate( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("ascLocation") String ascLocation, + @PathParam("jitNetworkAccessPolicyName") String jitNetworkAccessPolicyName, + @PathParam("jitNetworkAccessPolicyInitiateType") String jitNetworkAccessPolicyInitiateType, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") JitNetworkAccessPolicyInitiateRequest body, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByRegionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupAndRegionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Policies for protecting resources using Just-in-Time access control. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list(this.client.getEndpoint(), this.client.getSubscriptionId(), apiVersion, accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Policies for protecting resources using Just-in-Time access control. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getSubscriptionId(), apiVersion, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Policies for protecting resources using Just-in-Time access control. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Policies for protecting resources using Just-in-Time access control. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Policies for protecting resources using Just-in-Time access control. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Policies for protecting resources using Just-in-Time access control. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Policies for protecting resources using Just-in-Time access control for the subscription, location. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByRegionSinglePageAsync(String ascLocation) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (ascLocation == null) { + return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByRegion( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + ascLocation, + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Policies for protecting resources using Just-in-Time access control for the subscription, location. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByRegionSinglePageAsync( + String ascLocation, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (ascLocation == null) { + return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByRegion( + this.client.getEndpoint(), this.client.getSubscriptionId(), ascLocation, apiVersion, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Policies for protecting resources using Just-in-Time access control for the subscription, location. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByRegionAsync(String ascLocation) { + return new PagedFlux<>( + () -> listByRegionSinglePageAsync(ascLocation), nextLink -> listByRegionNextSinglePageAsync(nextLink)); + } + + /** + * Policies for protecting resources using Just-in-Time access control for the subscription, location. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByRegionAsync(String ascLocation, Context context) { + return new PagedFlux<>( + () -> listByRegionSinglePageAsync(ascLocation, context), + nextLink -> listByRegionNextSinglePageAsync(nextLink, context)); + } + + /** + * Policies for protecting resources using Just-in-Time access control for the subscription, location. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByRegion(String ascLocation) { + return new PagedIterable<>(listByRegionAsync(ascLocation)); + } + + /** + * Policies for protecting resources using Just-in-Time access control for the subscription, location. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByRegion(String ascLocation, Context context) { + return new PagedIterable<>(listByRegionAsync(ascLocation, context)); + } + + /** + * Policies for protecting resources using Just-in-Time access control for the subscription, location. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Policies for protecting resources using Just-in-Time access control for the subscription, location. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Policies for protecting resources using Just-in-Time access control for the subscription, location. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Policies for protecting resources using Just-in-Time access control for the subscription, location. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * Policies for protecting resources using Just-in-Time access control for the subscription, location. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * Policies for protecting resources using Just-in-Time access control for the subscription, location. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Policies for protecting resources using Just-in-Time access control for the subscription, location. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupAndRegionSinglePageAsync( + String resourceGroupName, String ascLocation) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (ascLocation == null) { + return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroupAndRegion( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + ascLocation, + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Policies for protecting resources using Just-in-Time access control for the subscription, location. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupAndRegionSinglePageAsync( + String resourceGroupName, String ascLocation, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (ascLocation == null) { + return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroupAndRegion( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + ascLocation, + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Policies for protecting resources using Just-in-Time access control for the subscription, location. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAndRegionAsync( + String resourceGroupName, String ascLocation) { + return new PagedFlux<>( + () -> listByResourceGroupAndRegionSinglePageAsync(resourceGroupName, ascLocation), + nextLink -> listByResourceGroupAndRegionNextSinglePageAsync(nextLink)); + } + + /** + * Policies for protecting resources using Just-in-Time access control for the subscription, location. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAndRegionAsync( + String resourceGroupName, String ascLocation, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupAndRegionSinglePageAsync(resourceGroupName, ascLocation, context), + nextLink -> listByResourceGroupAndRegionNextSinglePageAsync(nextLink, context)); + } + + /** + * Policies for protecting resources using Just-in-Time access control for the subscription, location. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroupAndRegion( + String resourceGroupName, String ascLocation) { + return new PagedIterable<>(listByResourceGroupAndRegionAsync(resourceGroupName, ascLocation)); + } + + /** + * Policies for protecting resources using Just-in-Time access control for the subscription, location. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroupAndRegion( + String resourceGroupName, String ascLocation, Context context) { + return new PagedIterable<>(listByResourceGroupAndRegionAsync(resourceGroupName, ascLocation, context)); + } + + /** + * Policies for protecting resources using Just-in-Time access control for the subscription, location. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param jitNetworkAccessPolicyName Name of a Just-in-Time access configuration policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String ascLocation, String jitNetworkAccessPolicyName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (ascLocation == null) { + return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + if (jitNetworkAccessPolicyName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter jitNetworkAccessPolicyName is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + ascLocation, + jitNetworkAccessPolicyName, + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Policies for protecting resources using Just-in-Time access control for the subscription, location. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param jitNetworkAccessPolicyName Name of a Just-in-Time access configuration policy. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String ascLocation, String jitNetworkAccessPolicyName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (ascLocation == null) { + return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + if (jitNetworkAccessPolicyName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter jitNetworkAccessPolicyName is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + ascLocation, + jitNetworkAccessPolicyName, + apiVersion, + accept, + context); + } + + /** + * Policies for protecting resources using Just-in-Time access control for the subscription, location. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param jitNetworkAccessPolicyName Name of a Just-in-Time access configuration policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String ascLocation, String jitNetworkAccessPolicyName) { + return getWithResponseAsync(resourceGroupName, ascLocation, jitNetworkAccessPolicyName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Policies for protecting resources using Just-in-Time access control for the subscription, location. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param jitNetworkAccessPolicyName Name of a Just-in-Time access configuration policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public JitNetworkAccessPolicyInner get( + String resourceGroupName, String ascLocation, String jitNetworkAccessPolicyName) { + return getAsync(resourceGroupName, ascLocation, jitNetworkAccessPolicyName).block(); + } + + /** + * Policies for protecting resources using Just-in-Time access control for the subscription, location. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param jitNetworkAccessPolicyName Name of a Just-in-Time access configuration policy. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String ascLocation, String jitNetworkAccessPolicyName, Context context) { + return getWithResponseAsync(resourceGroupName, ascLocation, jitNetworkAccessPolicyName, context).block(); + } + + /** + * Create a policy for protecting resources using Just-in-Time access control. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param jitNetworkAccessPolicyName Name of a Just-in-Time access configuration policy. + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String ascLocation, + String jitNetworkAccessPolicyName, + JitNetworkAccessPolicyInner body) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (ascLocation == null) { + return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + if (jitNetworkAccessPolicyName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter jitNetworkAccessPolicyName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + ascLocation, + jitNetworkAccessPolicyName, + apiVersion, + body, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create a policy for protecting resources using Just-in-Time access control. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param jitNetworkAccessPolicyName Name of a Just-in-Time access configuration policy. + * @param body The body parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String ascLocation, + String jitNetworkAccessPolicyName, + JitNetworkAccessPolicyInner body, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (ascLocation == null) { + return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + if (jitNetworkAccessPolicyName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter jitNetworkAccessPolicyName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + ascLocation, + jitNetworkAccessPolicyName, + apiVersion, + body, + accept, + context); + } + + /** + * Create a policy for protecting resources using Just-in-Time access control. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param jitNetworkAccessPolicyName Name of a Just-in-Time access configuration policy. + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String ascLocation, + String jitNetworkAccessPolicyName, + JitNetworkAccessPolicyInner body) { + return createOrUpdateWithResponseAsync(resourceGroupName, ascLocation, jitNetworkAccessPolicyName, body) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Create a policy for protecting resources using Just-in-Time access control. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param jitNetworkAccessPolicyName Name of a Just-in-Time access configuration policy. + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public JitNetworkAccessPolicyInner createOrUpdate( + String resourceGroupName, + String ascLocation, + String jitNetworkAccessPolicyName, + JitNetworkAccessPolicyInner body) { + return createOrUpdateAsync(resourceGroupName, ascLocation, jitNetworkAccessPolicyName, body).block(); + } + + /** + * Create a policy for protecting resources using Just-in-Time access control. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param jitNetworkAccessPolicyName Name of a Just-in-Time access configuration policy. + * @param body The body parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, + String ascLocation, + String jitNetworkAccessPolicyName, + JitNetworkAccessPolicyInner body, + Context context) { + return createOrUpdateWithResponseAsync( + resourceGroupName, ascLocation, jitNetworkAccessPolicyName, body, context) + .block(); + } + + /** + * Delete a Just-in-Time access control policy. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param jitNetworkAccessPolicyName Name of a Just-in-Time access configuration policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, String ascLocation, String jitNetworkAccessPolicyName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (ascLocation == null) { + return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + if (jitNetworkAccessPolicyName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter jitNetworkAccessPolicyName is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + ascLocation, + jitNetworkAccessPolicyName, + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a Just-in-Time access control policy. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param jitNetworkAccessPolicyName Name of a Just-in-Time access configuration policy. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, String ascLocation, String jitNetworkAccessPolicyName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (ascLocation == null) { + return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + if (jitNetworkAccessPolicyName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter jitNetworkAccessPolicyName is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + ascLocation, + jitNetworkAccessPolicyName, + apiVersion, + accept, + context); + } + + /** + * Delete a Just-in-Time access control policy. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param jitNetworkAccessPolicyName Name of a Just-in-Time access configuration policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String ascLocation, String jitNetworkAccessPolicyName) { + return deleteWithResponseAsync(resourceGroupName, ascLocation, jitNetworkAccessPolicyName) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Delete a Just-in-Time access control policy. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param jitNetworkAccessPolicyName Name of a Just-in-Time access configuration policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String ascLocation, String jitNetworkAccessPolicyName) { + deleteAsync(resourceGroupName, ascLocation, jitNetworkAccessPolicyName).block(); + } + + /** + * Delete a Just-in-Time access control policy. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param jitNetworkAccessPolicyName Name of a Just-in-Time access configuration policy. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse( + String resourceGroupName, String ascLocation, String jitNetworkAccessPolicyName, Context context) { + return deleteWithResponseAsync(resourceGroupName, ascLocation, jitNetworkAccessPolicyName, context).block(); + } + + /** + * Initiate a JIT access from a specific Just-in-Time policy configuration. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param jitNetworkAccessPolicyName Name of a Just-in-Time access configuration policy. + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> initiateWithResponseAsync( + String resourceGroupName, + String ascLocation, + String jitNetworkAccessPolicyName, + JitNetworkAccessPolicyInitiateRequest body) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (ascLocation == null) { + return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + if (jitNetworkAccessPolicyName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter jitNetworkAccessPolicyName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String jitNetworkAccessPolicyInitiateType = "initiate"; + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .initiate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + ascLocation, + jitNetworkAccessPolicyName, + jitNetworkAccessPolicyInitiateType, + apiVersion, + body, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Initiate a JIT access from a specific Just-in-Time policy configuration. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param jitNetworkAccessPolicyName Name of a Just-in-Time access configuration policy. + * @param body The body parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> initiateWithResponseAsync( + String resourceGroupName, + String ascLocation, + String jitNetworkAccessPolicyName, + JitNetworkAccessPolicyInitiateRequest body, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (ascLocation == null) { + return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + if (jitNetworkAccessPolicyName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter jitNetworkAccessPolicyName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String jitNetworkAccessPolicyInitiateType = "initiate"; + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .initiate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + ascLocation, + jitNetworkAccessPolicyName, + jitNetworkAccessPolicyInitiateType, + apiVersion, + body, + accept, + context); + } + + /** + * Initiate a JIT access from a specific Just-in-Time policy configuration. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param jitNetworkAccessPolicyName Name of a Just-in-Time access configuration policy. + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono initiateAsync( + String resourceGroupName, + String ascLocation, + String jitNetworkAccessPolicyName, + JitNetworkAccessPolicyInitiateRequest body) { + return initiateWithResponseAsync(resourceGroupName, ascLocation, jitNetworkAccessPolicyName, body) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Initiate a JIT access from a specific Just-in-Time policy configuration. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param jitNetworkAccessPolicyName Name of a Just-in-Time access configuration policy. + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public JitNetworkAccessRequestInner initiate( + String resourceGroupName, + String ascLocation, + String jitNetworkAccessPolicyName, + JitNetworkAccessPolicyInitiateRequest body) { + return initiateAsync(resourceGroupName, ascLocation, jitNetworkAccessPolicyName, body).block(); + } + + /** + * Initiate a JIT access from a specific Just-in-Time policy configuration. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param jitNetworkAccessPolicyName Name of a Just-in-Time access configuration policy. + * @param body The body parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response initiateWithResponse( + String resourceGroupName, + String ascLocation, + String jitNetworkAccessPolicyName, + JitNetworkAccessPolicyInitiateRequest body, + Context context) { + return initiateWithResponseAsync(resourceGroupName, ascLocation, jitNetworkAccessPolicyName, body, context) + .block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByRegionNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByRegionNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByRegionNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByRegionNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupAndRegionNextSinglePageAsync( + String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service.listByResourceGroupAndRegionNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupAndRegionNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroupAndRegionNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/JitNetworkAccessPoliciesImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/JitNetworkAccessPoliciesImpl.java new file mode 100644 index 000000000000..aaf32f637f5c --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/JitNetworkAccessPoliciesImpl.java @@ -0,0 +1,279 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.JitNetworkAccessPoliciesClient; +import com.azure.resourcemanager.security.fluent.models.JitNetworkAccessPolicyInner; +import com.azure.resourcemanager.security.fluent.models.JitNetworkAccessRequestInner; +import com.azure.resourcemanager.security.models.JitNetworkAccessPolicies; +import com.azure.resourcemanager.security.models.JitNetworkAccessPolicy; +import com.azure.resourcemanager.security.models.JitNetworkAccessPolicyInitiateRequest; +import com.azure.resourcemanager.security.models.JitNetworkAccessRequest; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class JitNetworkAccessPoliciesImpl implements JitNetworkAccessPolicies { + @JsonIgnore private final ClientLogger logger = new ClientLogger(JitNetworkAccessPoliciesImpl.class); + + private final JitNetworkAccessPoliciesClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public JitNetworkAccessPoliciesImpl( + JitNetworkAccessPoliciesClient innerClient, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new JitNetworkAccessPolicyImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new JitNetworkAccessPolicyImpl(inner1, this.manager())); + } + + public PagedIterable listByRegion(String ascLocation) { + PagedIterable inner = this.serviceClient().listByRegion(ascLocation); + return Utils.mapPage(inner, inner1 -> new JitNetworkAccessPolicyImpl(inner1, this.manager())); + } + + public PagedIterable listByRegion(String ascLocation, Context context) { + PagedIterable inner = this.serviceClient().listByRegion(ascLocation, context); + return Utils.mapPage(inner, inner1 -> new JitNetworkAccessPolicyImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new JitNetworkAccessPolicyImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = + this.serviceClient().listByResourceGroup(resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new JitNetworkAccessPolicyImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroupAndRegion( + String resourceGroupName, String ascLocation) { + PagedIterable inner = + this.serviceClient().listByResourceGroupAndRegion(resourceGroupName, ascLocation); + return Utils.mapPage(inner, inner1 -> new JitNetworkAccessPolicyImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroupAndRegion( + String resourceGroupName, String ascLocation, Context context) { + PagedIterable inner = + this.serviceClient().listByResourceGroupAndRegion(resourceGroupName, ascLocation, context); + return Utils.mapPage(inner, inner1 -> new JitNetworkAccessPolicyImpl(inner1, this.manager())); + } + + public JitNetworkAccessPolicy get(String resourceGroupName, String ascLocation, String jitNetworkAccessPolicyName) { + JitNetworkAccessPolicyInner inner = + this.serviceClient().get(resourceGroupName, ascLocation, jitNetworkAccessPolicyName); + if (inner != null) { + return new JitNetworkAccessPolicyImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String ascLocation, String jitNetworkAccessPolicyName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, ascLocation, jitNetworkAccessPolicyName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new JitNetworkAccessPolicyImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String ascLocation, String jitNetworkAccessPolicyName) { + this.serviceClient().delete(resourceGroupName, ascLocation, jitNetworkAccessPolicyName); + } + + public Response deleteWithResponse( + String resourceGroupName, String ascLocation, String jitNetworkAccessPolicyName, Context context) { + return this + .serviceClient() + .deleteWithResponse(resourceGroupName, ascLocation, jitNetworkAccessPolicyName, context); + } + + public JitNetworkAccessRequest initiate( + String resourceGroupName, + String ascLocation, + String jitNetworkAccessPolicyName, + JitNetworkAccessPolicyInitiateRequest body) { + JitNetworkAccessRequestInner inner = + this.serviceClient().initiate(resourceGroupName, ascLocation, jitNetworkAccessPolicyName, body); + if (inner != null) { + return new JitNetworkAccessRequestImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response initiateWithResponse( + String resourceGroupName, + String ascLocation, + String jitNetworkAccessPolicyName, + JitNetworkAccessPolicyInitiateRequest body, + Context context) { + Response inner = + this + .serviceClient() + .initiateWithResponse(resourceGroupName, ascLocation, jitNetworkAccessPolicyName, body, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new JitNetworkAccessRequestImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public JitNetworkAccessPolicy getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String ascLocation = Utils.getValueFromIdByName(id, "locations"); + if (ascLocation == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'locations'.", id))); + } + String jitNetworkAccessPolicyName = Utils.getValueFromIdByName(id, "jitNetworkAccessPolicies"); + if (jitNetworkAccessPolicyName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'jitNetworkAccessPolicies'.", + id))); + } + return this + .getWithResponse(resourceGroupName, ascLocation, jitNetworkAccessPolicyName, Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String ascLocation = Utils.getValueFromIdByName(id, "locations"); + if (ascLocation == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'locations'.", id))); + } + String jitNetworkAccessPolicyName = Utils.getValueFromIdByName(id, "jitNetworkAccessPolicies"); + if (jitNetworkAccessPolicyName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'jitNetworkAccessPolicies'.", + id))); + } + return this.getWithResponse(resourceGroupName, ascLocation, jitNetworkAccessPolicyName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String ascLocation = Utils.getValueFromIdByName(id, "locations"); + if (ascLocation == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'locations'.", id))); + } + String jitNetworkAccessPolicyName = Utils.getValueFromIdByName(id, "jitNetworkAccessPolicies"); + if (jitNetworkAccessPolicyName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'jitNetworkAccessPolicies'.", + id))); + } + this.deleteWithResponse(resourceGroupName, ascLocation, jitNetworkAccessPolicyName, Context.NONE).getValue(); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String ascLocation = Utils.getValueFromIdByName(id, "locations"); + if (ascLocation == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'locations'.", id))); + } + String jitNetworkAccessPolicyName = Utils.getValueFromIdByName(id, "jitNetworkAccessPolicies"); + if (jitNetworkAccessPolicyName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'jitNetworkAccessPolicies'.", + id))); + } + return this.deleteWithResponse(resourceGroupName, ascLocation, jitNetworkAccessPolicyName, context); + } + + private JitNetworkAccessPoliciesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } + + public JitNetworkAccessPolicyImpl define(String name) { + return new JitNetworkAccessPolicyImpl(name, this.manager()); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/JitNetworkAccessPolicyImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/JitNetworkAccessPolicyImpl.java new file mode 100644 index 000000000000..eb48f5aa58c7 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/JitNetworkAccessPolicyImpl.java @@ -0,0 +1,196 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.JitNetworkAccessPolicyInner; +import com.azure.resourcemanager.security.fluent.models.JitNetworkAccessRequestInner; +import com.azure.resourcemanager.security.models.JitNetworkAccessPolicy; +import com.azure.resourcemanager.security.models.JitNetworkAccessPolicyVirtualMachine; +import com.azure.resourcemanager.security.models.JitNetworkAccessRequest; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +public final class JitNetworkAccessPolicyImpl + implements JitNetworkAccessPolicy, JitNetworkAccessPolicy.Definition, JitNetworkAccessPolicy.Update { + private JitNetworkAccessPolicyInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public List virtualMachines() { + List inner = this.innerModel().virtualMachines(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List requests() { + List inner = this.innerModel().requests(); + if (inner != null) { + return Collections + .unmodifiableList( + inner + .stream() + .map(inner1 -> new JitNetworkAccessRequestImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return Collections.emptyList(); + } + } + + public String provisioningState() { + return this.innerModel().provisioningState(); + } + + public String kind() { + return this.innerModel().kind(); + } + + public String location() { + return this.innerModel().location(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public JitNetworkAccessPolicyInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String ascLocation; + + private String jitNetworkAccessPolicyName; + + public JitNetworkAccessPolicyImpl withExistingLocation(String resourceGroupName, String ascLocation) { + this.resourceGroupName = resourceGroupName; + this.ascLocation = ascLocation; + return this; + } + + public JitNetworkAccessPolicy create() { + this.innerObject = + serviceManager + .serviceClient() + .getJitNetworkAccessPolicies() + .createOrUpdateWithResponse( + resourceGroupName, ascLocation, jitNetworkAccessPolicyName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public JitNetworkAccessPolicy create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getJitNetworkAccessPolicies() + .createOrUpdateWithResponse( + resourceGroupName, ascLocation, jitNetworkAccessPolicyName, this.innerModel(), context) + .getValue(); + return this; + } + + JitNetworkAccessPolicyImpl(String name, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = new JitNetworkAccessPolicyInner(); + this.serviceManager = serviceManager; + this.jitNetworkAccessPolicyName = name; + } + + public JitNetworkAccessPolicyImpl update() { + return this; + } + + public JitNetworkAccessPolicy apply() { + this.innerObject = + serviceManager + .serviceClient() + .getJitNetworkAccessPolicies() + .createOrUpdateWithResponse( + resourceGroupName, ascLocation, jitNetworkAccessPolicyName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public JitNetworkAccessPolicy apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getJitNetworkAccessPolicies() + .createOrUpdateWithResponse( + resourceGroupName, ascLocation, jitNetworkAccessPolicyName, this.innerModel(), context) + .getValue(); + return this; + } + + JitNetworkAccessPolicyImpl( + JitNetworkAccessPolicyInner innerObject, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.ascLocation = Utils.getValueFromIdByName(innerObject.id(), "locations"); + this.jitNetworkAccessPolicyName = Utils.getValueFromIdByName(innerObject.id(), "jitNetworkAccessPolicies"); + } + + public JitNetworkAccessPolicy refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getJitNetworkAccessPolicies() + .getWithResponse(resourceGroupName, ascLocation, jitNetworkAccessPolicyName, Context.NONE) + .getValue(); + return this; + } + + public JitNetworkAccessPolicy refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getJitNetworkAccessPolicies() + .getWithResponse(resourceGroupName, ascLocation, jitNetworkAccessPolicyName, context) + .getValue(); + return this; + } + + public JitNetworkAccessPolicyImpl withVirtualMachines(List virtualMachines) { + this.innerModel().withVirtualMachines(virtualMachines); + return this; + } + + public JitNetworkAccessPolicyImpl withRequests(List requests) { + this.innerModel().withRequests(requests); + return this; + } + + public JitNetworkAccessPolicyImpl withKind(String kind) { + this.innerModel().withKind(kind); + return this; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/JitNetworkAccessRequestImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/JitNetworkAccessRequestImpl.java new file mode 100644 index 000000000000..0cf244c2e8b9 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/JitNetworkAccessRequestImpl.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.resourcemanager.security.fluent.models.JitNetworkAccessRequestInner; +import com.azure.resourcemanager.security.models.JitNetworkAccessRequest; +import com.azure.resourcemanager.security.models.JitNetworkAccessRequestVirtualMachine; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; + +public final class JitNetworkAccessRequestImpl implements JitNetworkAccessRequest { + private JitNetworkAccessRequestInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + JitNetworkAccessRequestImpl( + JitNetworkAccessRequestInner innerObject, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public List virtualMachines() { + List inner = this.innerModel().virtualMachines(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public OffsetDateTime startTimeUtc() { + return this.innerModel().startTimeUtc(); + } + + public String requestor() { + return this.innerModel().requestor(); + } + + public String justification() { + return this.innerModel().justification(); + } + + public JitNetworkAccessRequestInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/LocationsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/LocationsClientImpl.java new file mode 100644 index 000000000000..acd2064e0eee --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/LocationsClientImpl.java @@ -0,0 +1,442 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.LocationsClient; +import com.azure.resourcemanager.security.fluent.models.AscLocationInner; +import com.azure.resourcemanager.security.models.AscLocationList; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in LocationsClient. */ +public final class LocationsClientImpl implements LocationsClient { + private final ClientLogger logger = new ClientLogger(LocationsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final LocationsService service; + + /** The service client containing this operation class. */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of LocationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + LocationsClientImpl(SecurityCenterImpl client) { + this.service = + RestProxy.create(LocationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterLocations to be used by the proxy service to perform + * REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityCenterLocati") + private interface LocationsService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("ascLocation") String ascLocation, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * The location of the responsible ASC of the specific subscription (home region). For each subscription there is + * only one responsible location. The location in the response should be used to read or write other resources in + * ASC according to their ID. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of locations where ASC saves your data. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2015-06-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The location of the responsible ASC of the specific subscription (home region). For each subscription there is + * only one responsible location. The location in the response should be used to read or write other resources in + * ASC according to their ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of locations where ASC saves your data. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2015-06-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * The location of the responsible ASC of the specific subscription (home region). For each subscription there is + * only one responsible location. The location in the response should be used to read or write other resources in + * ASC according to their ID. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of locations where ASC saves your data. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * The location of the responsible ASC of the specific subscription (home region). For each subscription there is + * only one responsible location. The location in the response should be used to read or write other resources in + * ASC according to their ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of locations where ASC saves your data. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * The location of the responsible ASC of the specific subscription (home region). For each subscription there is + * only one responsible location. The location in the response should be used to read or write other resources in + * ASC according to their ID. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of locations where ASC saves your data. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * The location of the responsible ASC of the specific subscription (home region). For each subscription there is + * only one responsible location. The location in the response should be used to read or write other resources in + * ASC according to their ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of locations where ASC saves your data. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Details of a specific location. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the ASC location of the subscription is in the "name" field. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String ascLocation) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (ascLocation == null) { + return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + final String apiVersion = "2015-06-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + ascLocation, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Details of a specific location. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the ASC location of the subscription is in the "name" field. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String ascLocation, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (ascLocation == null) { + return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + final String apiVersion = "2015-06-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), ascLocation, accept, context); + } + + /** + * Details of a specific location. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the ASC location of the subscription is in the "name" field. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String ascLocation) { + return getWithResponseAsync(ascLocation) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Details of a specific location. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the ASC location of the subscription is in the "name" field. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AscLocationInner get(String ascLocation) { + return getAsync(ascLocation).block(); + } + + /** + * Details of a specific location. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the ASC location of the subscription is in the "name" field. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String ascLocation, Context context) { + return getWithResponseAsync(ascLocation, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of locations where ASC saves your data. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of locations where ASC saves your data. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/LocationsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/LocationsImpl.java new file mode 100644 index 000000000000..7b4c5afc2431 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/LocationsImpl.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.LocationsClient; +import com.azure.resourcemanager.security.fluent.models.AscLocationInner; +import com.azure.resourcemanager.security.models.AscLocation; +import com.azure.resourcemanager.security.models.Locations; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class LocationsImpl implements Locations { + @JsonIgnore private final ClientLogger logger = new ClientLogger(LocationsImpl.class); + + private final LocationsClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public LocationsImpl( + LocationsClient innerClient, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new AscLocationImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new AscLocationImpl(inner1, this.manager())); + } + + public AscLocation get(String ascLocation) { + AscLocationInner inner = this.serviceClient().get(ascLocation); + if (inner != null) { + return new AscLocationImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse(String ascLocation, Context context) { + Response inner = this.serviceClient().getWithResponse(ascLocation, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new AscLocationImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private LocationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/OnPremiseIotSensorImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/OnPremiseIotSensorImpl.java new file mode 100644 index 000000000000..0e90e7e569cb --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/OnPremiseIotSensorImpl.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.resourcemanager.security.fluent.models.OnPremiseIotSensorInner; +import com.azure.resourcemanager.security.models.OnPremiseIotSensor; + +public final class OnPremiseIotSensorImpl implements OnPremiseIotSensor { + private OnPremiseIotSensorInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + OnPremiseIotSensorImpl( + OnPremiseIotSensorInner innerObject, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public Object properties() { + return this.innerModel().properties(); + } + + public OnPremiseIotSensorInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/OnPremiseIotSensorsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/OnPremiseIotSensorsClientImpl.java new file mode 100644 index 000000000000..baab7b119bdb --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/OnPremiseIotSensorsClientImpl.java @@ -0,0 +1,971 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.http.rest.StreamResponse; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.OnPremiseIotSensorsClient; +import com.azure.resourcemanager.security.fluent.models.OnPremiseIotSensorInner; +import com.azure.resourcemanager.security.fluent.models.OnPremiseIotSensorsListInner; +import com.azure.resourcemanager.security.models.ResetPasswordInput; +import com.fasterxml.jackson.databind.util.ByteBufferBackedInputStream; +import java.io.InputStream; +import java.io.SequenceInputStream; +import java.nio.ByteBuffer; +import java.util.Enumeration; +import java.util.Iterator; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in OnPremiseIotSensorsClient. */ +public final class OnPremiseIotSensorsClientImpl implements OnPremiseIotSensorsClient { + private final ClientLogger logger = new ClientLogger(OnPremiseIotSensorsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final OnPremiseIotSensorsService service; + + /** The service client containing this operation class. */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of OnPremiseIotSensorsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OnPremiseIotSensorsClientImpl(SecurityCenterImpl client) { + this.service = + RestProxy.create(OnPremiseIotSensorsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterOnPremiseIotSensors to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityCenterOnPrem") + private interface OnPremiseIotSensorsService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/onPremiseIotSensors") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/providers/Microsoft.Security/onPremiseIotSensors/{onPremiseIotSensorName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("onPremiseIotSensorName") String onPremiseIotSensorName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/providers/Microsoft.Security/onPremiseIotSensors/{onPremiseIotSensorName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("onPremiseIotSensorName") String onPremiseIotSensorName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/providers/Microsoft.Security/onPremiseIotSensors/{onPremiseIotSensorName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("onPremiseIotSensorName") String onPremiseIotSensorName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/providers/Microsoft.Security/onPremiseIotSensors/{onPremiseIotSensorName}" + + "/downloadActivation") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono downloadActivation( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("onPremiseIotSensorName") String onPremiseIotSensorName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/providers/Microsoft.Security/onPremiseIotSensors/{onPremiseIotSensorName}" + + "/downloadResetPassword") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono downloadResetPassword( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("onPremiseIotSensorName") String onPremiseIotSensorName, + @BodyParam("application/json") ResetPasswordInput body, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List on-premise IoT sensors. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of on-premise IoT sensors. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listWithResponseAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-08-06-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List on-premise IoT sensors. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of on-premise IoT sensors. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listWithResponseAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-08-06-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), accept, context); + } + + /** + * List on-premise IoT sensors. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of on-premise IoT sensors. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listAsync() { + return listWithResponseAsync() + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * List on-premise IoT sensors. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of on-premise IoT sensors. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public OnPremiseIotSensorsListInner list() { + return listAsync().block(); + } + + /** + * List on-premise IoT sensors. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of on-premise IoT sensors. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listWithResponse(Context context) { + return listWithResponseAsync(context).block(); + } + + /** + * Get on-premise IoT sensor. + * + * @param onPremiseIotSensorName Name of the on-premise IoT sensor. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return on-premise IoT sensor. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String onPremiseIotSensorName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (onPremiseIotSensorName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter onPremiseIotSensorName is required and cannot be null.")); + } + final String apiVersion = "2020-08-06-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + onPremiseIotSensorName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get on-premise IoT sensor. + * + * @param onPremiseIotSensorName Name of the on-premise IoT sensor. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return on-premise IoT sensor. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String onPremiseIotSensorName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (onPremiseIotSensorName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter onPremiseIotSensorName is required and cannot be null.")); + } + final String apiVersion = "2020-08-06-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + onPremiseIotSensorName, + accept, + context); + } + + /** + * Get on-premise IoT sensor. + * + * @param onPremiseIotSensorName Name of the on-premise IoT sensor. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return on-premise IoT sensor. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String onPremiseIotSensorName) { + return getWithResponseAsync(onPremiseIotSensorName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get on-premise IoT sensor. + * + * @param onPremiseIotSensorName Name of the on-premise IoT sensor. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return on-premise IoT sensor. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public OnPremiseIotSensorInner get(String onPremiseIotSensorName) { + return getAsync(onPremiseIotSensorName).block(); + } + + /** + * Get on-premise IoT sensor. + * + * @param onPremiseIotSensorName Name of the on-premise IoT sensor. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return on-premise IoT sensor. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String onPremiseIotSensorName, Context context) { + return getWithResponseAsync(onPremiseIotSensorName, context).block(); + } + + /** + * Create or update on-premise IoT sensor. + * + * @param onPremiseIotSensorName Name of the on-premise IoT sensor. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return on-premise IoT sensor. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync(String onPremiseIotSensorName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (onPremiseIotSensorName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter onPremiseIotSensorName is required and cannot be null.")); + } + final String apiVersion = "2020-08-06-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + onPremiseIotSensorName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create or update on-premise IoT sensor. + * + * @param onPremiseIotSensorName Name of the on-premise IoT sensor. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return on-premise IoT sensor. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String onPremiseIotSensorName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (onPremiseIotSensorName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter onPremiseIotSensorName is required and cannot be null.")); + } + final String apiVersion = "2020-08-06-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + onPremiseIotSensorName, + accept, + context); + } + + /** + * Create or update on-premise IoT sensor. + * + * @param onPremiseIotSensorName Name of the on-premise IoT sensor. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return on-premise IoT sensor. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String onPremiseIotSensorName) { + return createOrUpdateWithResponseAsync(onPremiseIotSensorName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Create or update on-premise IoT sensor. + * + * @param onPremiseIotSensorName Name of the on-premise IoT sensor. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return on-premise IoT sensor. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public OnPremiseIotSensorInner createOrUpdate(String onPremiseIotSensorName) { + return createOrUpdateAsync(onPremiseIotSensorName).block(); + } + + /** + * Create or update on-premise IoT sensor. + * + * @param onPremiseIotSensorName Name of the on-premise IoT sensor. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return on-premise IoT sensor. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String onPremiseIotSensorName, Context context) { + return createOrUpdateWithResponseAsync(onPremiseIotSensorName, context).block(); + } + + /** + * Delete on-premise IoT sensor. + * + * @param onPremiseIotSensorName Name of the on-premise IoT sensor. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String onPremiseIotSensorName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (onPremiseIotSensorName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter onPremiseIotSensorName is required and cannot be null.")); + } + final String apiVersion = "2020-08-06-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + onPremiseIotSensorName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete on-premise IoT sensor. + * + * @param onPremiseIotSensorName Name of the on-premise IoT sensor. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String onPremiseIotSensorName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (onPremiseIotSensorName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter onPremiseIotSensorName is required and cannot be null.")); + } + final String apiVersion = "2020-08-06-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + onPremiseIotSensorName, + accept, + context); + } + + /** + * Delete on-premise IoT sensor. + * + * @param onPremiseIotSensorName Name of the on-premise IoT sensor. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String onPremiseIotSensorName) { + return deleteWithResponseAsync(onPremiseIotSensorName).flatMap((Response res) -> Mono.empty()); + } + + /** + * Delete on-premise IoT sensor. + * + * @param onPremiseIotSensorName Name of the on-premise IoT sensor. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String onPremiseIotSensorName) { + deleteAsync(onPremiseIotSensorName).block(); + } + + /** + * Delete on-premise IoT sensor. + * + * @param onPremiseIotSensorName Name of the on-premise IoT sensor. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String onPremiseIotSensorName, Context context) { + return deleteWithResponseAsync(onPremiseIotSensorName, context).block(); + } + + /** + * Download sensor activation file. + * + * @param onPremiseIotSensorName Name of the on-premise IoT sensor. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono downloadActivationWithResponseAsync(String onPremiseIotSensorName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (onPremiseIotSensorName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter onPremiseIotSensorName is required and cannot be null.")); + } + final String apiVersion = "2020-08-06-preview"; + final String accept = "application/zip"; + return FluxUtil + .withContext( + context -> + service + .downloadActivation( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + onPremiseIotSensorName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Download sensor activation file. + * + * @param onPremiseIotSensorName Name of the on-premise IoT sensor. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono downloadActivationWithResponseAsync(String onPremiseIotSensorName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (onPremiseIotSensorName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter onPremiseIotSensorName is required and cannot be null.")); + } + final String apiVersion = "2020-08-06-preview"; + final String accept = "application/zip"; + context = this.client.mergeContext(context); + return service + .downloadActivation( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + onPremiseIotSensorName, + accept, + context); + } + + /** + * Download sensor activation file. + * + * @param onPremiseIotSensorName Name of the on-premise IoT sensor. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Flux downloadActivationAsync(String onPremiseIotSensorName) { + return downloadActivationWithResponseAsync(onPremiseIotSensorName).flatMapMany(StreamResponse::getValue); + } + + /** + * Download sensor activation file. + * + * @param onPremiseIotSensorName Name of the on-premise IoT sensor. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public InputStream downloadActivation(String onPremiseIotSensorName) { + Iterator iterator = + downloadActivationAsync(onPremiseIotSensorName).map(ByteBufferBackedInputStream::new).toStream().iterator(); + Enumeration enumeration = + new Enumeration() { + @Override + public boolean hasMoreElements() { + return iterator.hasNext(); + } + + @Override + public InputStream nextElement() { + return iterator.next(); + } + }; + return new SequenceInputStream(enumeration); + } + + /** + * Download sensor activation file. + * + * @param onPremiseIotSensorName Name of the on-premise IoT sensor. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public StreamResponse downloadActivationWithResponse(String onPremiseIotSensorName, Context context) { + return downloadActivationWithResponseAsync(onPremiseIotSensorName, context).block(); + } + + /** + * Download file for reset password of the sensor. + * + * @param onPremiseIotSensorName Name of the on-premise IoT sensor. + * @param body Input for reset password. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono downloadResetPasswordWithResponseAsync( + String onPremiseIotSensorName, ResetPasswordInput body) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (onPremiseIotSensorName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter onPremiseIotSensorName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String apiVersion = "2020-08-06-preview"; + final String accept = "application/zip"; + return FluxUtil + .withContext( + context -> + service + .downloadResetPassword( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + onPremiseIotSensorName, + body, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Download file for reset password of the sensor. + * + * @param onPremiseIotSensorName Name of the on-premise IoT sensor. + * @param body Input for reset password. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono downloadResetPasswordWithResponseAsync( + String onPremiseIotSensorName, ResetPasswordInput body, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (onPremiseIotSensorName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter onPremiseIotSensorName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String apiVersion = "2020-08-06-preview"; + final String accept = "application/zip"; + context = this.client.mergeContext(context); + return service + .downloadResetPassword( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + onPremiseIotSensorName, + body, + accept, + context); + } + + /** + * Download file for reset password of the sensor. + * + * @param onPremiseIotSensorName Name of the on-premise IoT sensor. + * @param body Input for reset password. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Flux downloadResetPasswordAsync(String onPremiseIotSensorName, ResetPasswordInput body) { + return downloadResetPasswordWithResponseAsync(onPremiseIotSensorName, body) + .flatMapMany(StreamResponse::getValue); + } + + /** + * Download file for reset password of the sensor. + * + * @param onPremiseIotSensorName Name of the on-premise IoT sensor. + * @param body Input for reset password. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public InputStream downloadResetPassword(String onPremiseIotSensorName, ResetPasswordInput body) { + Iterator iterator = + downloadResetPasswordAsync(onPremiseIotSensorName, body) + .map(ByteBufferBackedInputStream::new) + .toStream() + .iterator(); + Enumeration enumeration = + new Enumeration() { + @Override + public boolean hasMoreElements() { + return iterator.hasNext(); + } + + @Override + public InputStream nextElement() { + return iterator.next(); + } + }; + return new SequenceInputStream(enumeration); + } + + /** + * Download file for reset password of the sensor. + * + * @param onPremiseIotSensorName Name of the on-premise IoT sensor. + * @param body Input for reset password. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public StreamResponse downloadResetPasswordWithResponse( + String onPremiseIotSensorName, ResetPasswordInput body, Context context) { + return downloadResetPasswordWithResponseAsync(onPremiseIotSensorName, body, context).block(); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/OnPremiseIotSensorsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/OnPremiseIotSensorsImpl.java new file mode 100644 index 000000000000..74df09ca6ff5 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/OnPremiseIotSensorsImpl.java @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.http.rest.StreamResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.OnPremiseIotSensorsClient; +import com.azure.resourcemanager.security.fluent.models.OnPremiseIotSensorInner; +import com.azure.resourcemanager.security.fluent.models.OnPremiseIotSensorsListInner; +import com.azure.resourcemanager.security.models.OnPremiseIotSensor; +import com.azure.resourcemanager.security.models.OnPremiseIotSensors; +import com.azure.resourcemanager.security.models.OnPremiseIotSensorsList; +import com.azure.resourcemanager.security.models.ResetPasswordInput; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.io.InputStream; + +public final class OnPremiseIotSensorsImpl implements OnPremiseIotSensors { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OnPremiseIotSensorsImpl.class); + + private final OnPremiseIotSensorsClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public OnPremiseIotSensorsImpl( + OnPremiseIotSensorsClient innerClient, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public OnPremiseIotSensorsList list() { + OnPremiseIotSensorsListInner inner = this.serviceClient().list(); + if (inner != null) { + return new OnPremiseIotSensorsListImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response listWithResponse(Context context) { + Response inner = this.serviceClient().listWithResponse(context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new OnPremiseIotSensorsListImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public OnPremiseIotSensor get(String onPremiseIotSensorName) { + OnPremiseIotSensorInner inner = this.serviceClient().get(onPremiseIotSensorName); + if (inner != null) { + return new OnPremiseIotSensorImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse(String onPremiseIotSensorName, Context context) { + Response inner = this.serviceClient().getWithResponse(onPremiseIotSensorName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new OnPremiseIotSensorImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public OnPremiseIotSensor createOrUpdate(String onPremiseIotSensorName) { + OnPremiseIotSensorInner inner = this.serviceClient().createOrUpdate(onPremiseIotSensorName); + if (inner != null) { + return new OnPremiseIotSensorImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response createOrUpdateWithResponse(String onPremiseIotSensorName, Context context) { + Response inner = + this.serviceClient().createOrUpdateWithResponse(onPremiseIotSensorName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new OnPremiseIotSensorImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String onPremiseIotSensorName) { + this.serviceClient().delete(onPremiseIotSensorName); + } + + public Response deleteWithResponse(String onPremiseIotSensorName, Context context) { + return this.serviceClient().deleteWithResponse(onPremiseIotSensorName, context); + } + + public InputStream downloadActivation(String onPremiseIotSensorName) { + return this.serviceClient().downloadActivation(onPremiseIotSensorName); + } + + public StreamResponse downloadActivationWithResponse(String onPremiseIotSensorName, Context context) { + return this.serviceClient().downloadActivationWithResponse(onPremiseIotSensorName, context); + } + + public InputStream downloadResetPassword(String onPremiseIotSensorName, ResetPasswordInput body) { + return this.serviceClient().downloadResetPassword(onPremiseIotSensorName, body); + } + + public StreamResponse downloadResetPasswordWithResponse( + String onPremiseIotSensorName, ResetPasswordInput body, Context context) { + return this.serviceClient().downloadResetPasswordWithResponse(onPremiseIotSensorName, body, context); + } + + private OnPremiseIotSensorsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/OnPremiseIotSensorsListImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/OnPremiseIotSensorsListImpl.java new file mode 100644 index 000000000000..2a4b774c145c --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/OnPremiseIotSensorsListImpl.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.resourcemanager.security.fluent.models.OnPremiseIotSensorInner; +import com.azure.resourcemanager.security.fluent.models.OnPremiseIotSensorsListInner; +import com.azure.resourcemanager.security.models.OnPremiseIotSensor; +import com.azure.resourcemanager.security.models.OnPremiseIotSensorsList; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +public final class OnPremiseIotSensorsListImpl implements OnPremiseIotSensorsList { + private OnPremiseIotSensorsListInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + OnPremiseIotSensorsListImpl( + OnPremiseIotSensorsListInner innerObject, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public List value() { + List inner = this.innerModel().value(); + if (inner != null) { + return Collections + .unmodifiableList( + inner + .stream() + .map(inner1 -> new OnPremiseIotSensorImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return Collections.emptyList(); + } + } + + public OnPremiseIotSensorsListInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/OperationImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/OperationImpl.java new file mode 100644 index 000000000000..9621ea680926 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/OperationImpl.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.resourcemanager.security.fluent.models.OperationInner; +import com.azure.resourcemanager.security.models.Operation; +import com.azure.resourcemanager.security.models.OperationDisplay; + +public final class OperationImpl implements Operation { + private OperationInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + OperationImpl(OperationInner innerObject, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String name() { + return this.innerModel().name(); + } + + public String origin() { + return this.innerModel().origin(); + } + + public OperationDisplay display() { + return this.innerModel().display(); + } + + public OperationInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/OperationsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/OperationsClientImpl.java new file mode 100644 index 000000000000..5609a7a475ca --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/OperationsClientImpl.java @@ -0,0 +1,270 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.OperationsClient; +import com.azure.resourcemanager.security.fluent.models.OperationInner; +import com.azure.resourcemanager.security.models.OperationList; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in OperationsClient. */ +public final class OperationsClientImpl implements OperationsClient { + private final ClientLogger logger = new ClientLogger(OperationsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final OperationsService service; + + /** The service client containing this operation class. */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(SecurityCenterImpl client) { + this.service = + RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterOperations to be used by the proxy service to perform + * REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityCenterOperat") + private interface OperationsService { + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.Security/operations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Exposes all available operations for discovery purposes. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of possible operations for Microsoft. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String apiVersion = "2015-06-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), apiVersion, accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Exposes all available operations for discovery purposes. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of possible operations for Microsoft. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String apiVersion = "2015-06-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), apiVersion, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Exposes all available operations for discovery purposes. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of possible operations for Microsoft. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Exposes all available operations for discovery purposes. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of possible operations for Microsoft. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Exposes all available operations for discovery purposes. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of possible operations for Microsoft. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Exposes all available operations for discovery purposes. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of possible operations for Microsoft. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of possible operations for Microsoft. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of possible operations for Microsoft. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/OperationsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/OperationsImpl.java new file mode 100644 index 000000000000..7e344a494b02 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/OperationsImpl.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.OperationsClient; +import com.azure.resourcemanager.security.fluent.models.OperationInner; +import com.azure.resourcemanager.security.models.Operation; +import com.azure.resourcemanager.security.models.Operations; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class OperationsImpl implements Operations { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationsImpl.class); + + private final OperationsClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public OperationsImpl( + OperationsClient innerClient, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + private OperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/PackageDownloadsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/PackageDownloadsImpl.java new file mode 100644 index 000000000000..41263da35fe8 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/PackageDownloadsImpl.java @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.resourcemanager.security.fluent.models.PackageDownloadsInner; +import com.azure.resourcemanager.security.models.PackageDownloadInfo; +import com.azure.resourcemanager.security.models.PackageDownloads; +import com.azure.resourcemanager.security.models.PackageDownloadsCentralManager; +import com.azure.resourcemanager.security.models.PackageDownloadsSensor; +import java.util.Collections; +import java.util.List; + +public final class PackageDownloadsImpl implements PackageDownloads { + private PackageDownloadsInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + PackageDownloadsImpl( + PackageDownloadsInner innerObject, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public PackageDownloadsSensor sensor() { + return this.innerModel().sensor(); + } + + public PackageDownloadsCentralManager centralManager() { + return this.innerModel().centralManager(); + } + + public List threatIntelligence() { + List inner = this.innerModel().threatIntelligence(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List snmp() { + List inner = this.innerModel().snmp(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List wmiTool() { + List inner = this.innerModel().wmiTool(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List authorizedDevicesImportTemplate() { + List inner = this.innerModel().authorizedDevicesImportTemplate(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List deviceInformationUpdateImportTemplate() { + List inner = this.innerModel().deviceInformationUpdateImportTemplate(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public PackageDownloadsInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/PricingImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/PricingImpl.java new file mode 100644 index 000000000000..dc877b2c31d7 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/PricingImpl.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.resourcemanager.security.fluent.models.PricingInner; +import com.azure.resourcemanager.security.models.Pricing; +import com.azure.resourcemanager.security.models.PricingTier; +import java.time.Duration; + +public final class PricingImpl implements Pricing { + private PricingInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + PricingImpl(PricingInner innerObject, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public PricingTier pricingTier() { + return this.innerModel().pricingTier(); + } + + public Duration freeTrialRemainingTime() { + return this.innerModel().freeTrialRemainingTime(); + } + + public PricingInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/PricingListImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/PricingListImpl.java new file mode 100644 index 000000000000..fce69ede7db3 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/PricingListImpl.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.resourcemanager.security.fluent.models.PricingInner; +import com.azure.resourcemanager.security.fluent.models.PricingListInner; +import com.azure.resourcemanager.security.models.Pricing; +import com.azure.resourcemanager.security.models.PricingList; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +public final class PricingListImpl implements PricingList { + private PricingListInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + PricingListImpl(PricingListInner innerObject, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public List value() { + List inner = this.innerModel().value(); + if (inner != null) { + return Collections + .unmodifiableList( + inner.stream().map(inner1 -> new PricingImpl(inner1, this.manager())).collect(Collectors.toList())); + } else { + return Collections.emptyList(); + } + } + + public PricingListInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/PricingsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/PricingsClientImpl.java new file mode 100644 index 000000000000..186e4f8e9833 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/PricingsClientImpl.java @@ -0,0 +1,484 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.PricingsClient; +import com.azure.resourcemanager.security.fluent.models.PricingInner; +import com.azure.resourcemanager.security.fluent.models.PricingListInner; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in PricingsClient. */ +public final class PricingsClientImpl implements PricingsClient { + private final ClientLogger logger = new ClientLogger(PricingsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final PricingsService service; + + /** The service client containing this operation class. */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of PricingsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PricingsClientImpl(SecurityCenterImpl client) { + this.service = RestProxy.create(PricingsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterPricings to be used by the proxy service to perform + * REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityCenterPricin") + private interface PricingsService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/pricings") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/pricings/{pricingName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("pricingName") String pricingName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put("/subscriptions/{subscriptionId}/providers/Microsoft.Security/pricings/{pricingName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("pricingName") String pricingName, + @BodyParam("application/json") PricingInner pricing, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists Security Center pricing configurations in the subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of pricing configurations response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listWithResponseAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2018-06-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists Security Center pricing configurations in the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of pricing configurations response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listWithResponseAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2018-06-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), accept, context); + } + + /** + * Lists Security Center pricing configurations in the subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of pricing configurations response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listAsync() { + return listWithResponseAsync() + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Lists Security Center pricing configurations in the subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of pricing configurations response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PricingListInner list() { + return listAsync().block(); + } + + /** + * Lists Security Center pricing configurations in the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of pricing configurations response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listWithResponse(Context context) { + return listWithResponseAsync(context).block(); + } + + /** + * Gets a provided Security Center pricing configuration in the subscription. + * + * @param pricingName name of the pricing configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a provided Security Center pricing configuration in the subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String pricingName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (pricingName == null) { + return Mono.error(new IllegalArgumentException("Parameter pricingName is required and cannot be null.")); + } + final String apiVersion = "2018-06-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + pricingName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a provided Security Center pricing configuration in the subscription. + * + * @param pricingName name of the pricing configuration. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a provided Security Center pricing configuration in the subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String pricingName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (pricingName == null) { + return Mono.error(new IllegalArgumentException("Parameter pricingName is required and cannot be null.")); + } + final String apiVersion = "2018-06-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), pricingName, accept, context); + } + + /** + * Gets a provided Security Center pricing configuration in the subscription. + * + * @param pricingName name of the pricing configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a provided Security Center pricing configuration in the subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String pricingName) { + return getWithResponseAsync(pricingName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a provided Security Center pricing configuration in the subscription. + * + * @param pricingName name of the pricing configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a provided Security Center pricing configuration in the subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PricingInner get(String pricingName) { + return getAsync(pricingName).block(); + } + + /** + * Gets a provided Security Center pricing configuration in the subscription. + * + * @param pricingName name of the pricing configuration. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a provided Security Center pricing configuration in the subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String pricingName, Context context) { + return getWithResponseAsync(pricingName, context).block(); + } + + /** + * Updates a provided Security Center pricing configuration in the subscription. + * + * @param pricingName name of the pricing configuration. + * @param pricing Pricing object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure Security Center is provided in two pricing tiers: free and standard, with the standard tier + * available with a trial period. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync(String pricingName, PricingInner pricing) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (pricingName == null) { + return Mono.error(new IllegalArgumentException("Parameter pricingName is required and cannot be null.")); + } + if (pricing == null) { + return Mono.error(new IllegalArgumentException("Parameter pricing is required and cannot be null.")); + } else { + pricing.validate(); + } + final String apiVersion = "2018-06-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + pricingName, + pricing, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates a provided Security Center pricing configuration in the subscription. + * + * @param pricingName name of the pricing configuration. + * @param pricing Pricing object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure Security Center is provided in two pricing tiers: free and standard, with the standard tier + * available with a trial period. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String pricingName, PricingInner pricing, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (pricingName == null) { + return Mono.error(new IllegalArgumentException("Parameter pricingName is required and cannot be null.")); + } + if (pricing == null) { + return Mono.error(new IllegalArgumentException("Parameter pricing is required and cannot be null.")); + } else { + pricing.validate(); + } + final String apiVersion = "2018-06-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + pricingName, + pricing, + accept, + context); + } + + /** + * Updates a provided Security Center pricing configuration in the subscription. + * + * @param pricingName name of the pricing configuration. + * @param pricing Pricing object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure Security Center is provided in two pricing tiers: free and standard, with the standard tier + * available with a trial period. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String pricingName, PricingInner pricing) { + return updateWithResponseAsync(pricingName, pricing) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Updates a provided Security Center pricing configuration in the subscription. + * + * @param pricingName name of the pricing configuration. + * @param pricing Pricing object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure Security Center is provided in two pricing tiers: free and standard, with the standard tier + * available with a trial period. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PricingInner update(String pricingName, PricingInner pricing) { + return updateAsync(pricingName, pricing).block(); + } + + /** + * Updates a provided Security Center pricing configuration in the subscription. + * + * @param pricingName name of the pricing configuration. + * @param pricing Pricing object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure Security Center is provided in two pricing tiers: free and standard, with the standard tier + * available with a trial period. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse(String pricingName, PricingInner pricing, Context context) { + return updateWithResponseAsync(pricingName, pricing, context).block(); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/PricingsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/PricingsImpl.java new file mode 100644 index 000000000000..6258451b1393 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/PricingsImpl.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.PricingsClient; +import com.azure.resourcemanager.security.fluent.models.PricingInner; +import com.azure.resourcemanager.security.fluent.models.PricingListInner; +import com.azure.resourcemanager.security.models.Pricing; +import com.azure.resourcemanager.security.models.PricingList; +import com.azure.resourcemanager.security.models.Pricings; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class PricingsImpl implements Pricings { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PricingsImpl.class); + + private final PricingsClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public PricingsImpl(PricingsClient innerClient, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PricingList list() { + PricingListInner inner = this.serviceClient().list(); + if (inner != null) { + return new PricingListImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response listWithResponse(Context context) { + Response inner = this.serviceClient().listWithResponse(context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new PricingListImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Pricing get(String pricingName) { + PricingInner inner = this.serviceClient().get(pricingName); + if (inner != null) { + return new PricingImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse(String pricingName, Context context) { + Response inner = this.serviceClient().getWithResponse(pricingName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new PricingImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Pricing update(String pricingName, PricingInner pricing) { + PricingInner inner = this.serviceClient().update(pricingName, pricing); + if (inner != null) { + return new PricingImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response updateWithResponse(String pricingName, PricingInner pricing, Context context) { + Response inner = this.serviceClient().updateWithResponse(pricingName, pricing, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new PricingImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private PricingsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/RegulatoryComplianceAssessmentImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/RegulatoryComplianceAssessmentImpl.java new file mode 100644 index 000000000000..d83de36d26c9 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/RegulatoryComplianceAssessmentImpl.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.resourcemanager.security.fluent.models.RegulatoryComplianceAssessmentInner; +import com.azure.resourcemanager.security.models.RegulatoryComplianceAssessment; +import com.azure.resourcemanager.security.models.State; + +public final class RegulatoryComplianceAssessmentImpl implements RegulatoryComplianceAssessment { + private RegulatoryComplianceAssessmentInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + RegulatoryComplianceAssessmentImpl( + RegulatoryComplianceAssessmentInner innerObject, + com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String description() { + return this.innerModel().description(); + } + + public String assessmentType() { + return this.innerModel().assessmentType(); + } + + public String assessmentDetailsLink() { + return this.innerModel().assessmentDetailsLink(); + } + + public State state() { + return this.innerModel().state(); + } + + public Integer passedResources() { + return this.innerModel().passedResources(); + } + + public Integer failedResources() { + return this.innerModel().failedResources(); + } + + public Integer skippedResources() { + return this.innerModel().skippedResources(); + } + + public Integer unsupportedResources() { + return this.innerModel().unsupportedResources(); + } + + public RegulatoryComplianceAssessmentInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/RegulatoryComplianceAssessmentsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/RegulatoryComplianceAssessmentsClientImpl.java new file mode 100644 index 000000000000..ff82436b2a41 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/RegulatoryComplianceAssessmentsClientImpl.java @@ -0,0 +1,617 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.RegulatoryComplianceAssessmentsClient; +import com.azure.resourcemanager.security.fluent.models.RegulatoryComplianceAssessmentInner; +import com.azure.resourcemanager.security.models.RegulatoryComplianceAssessmentList; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in RegulatoryComplianceAssessmentsClient. */ +public final class RegulatoryComplianceAssessmentsClientImpl implements RegulatoryComplianceAssessmentsClient { + private final ClientLogger logger = new ClientLogger(RegulatoryComplianceAssessmentsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final RegulatoryComplianceAssessmentsService service; + + /** The service client containing this operation class. */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of RegulatoryComplianceAssessmentsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + RegulatoryComplianceAssessmentsClientImpl(SecurityCenterImpl client) { + this.service = + RestProxy + .create( + RegulatoryComplianceAssessmentsService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterRegulatoryComplianceAssessments to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityCenterRegula") + private interface RegulatoryComplianceAssessmentsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/providers/Microsoft.Security/regulatoryComplianceStandards" + + "/{regulatoryComplianceStandardName}/regulatoryComplianceControls/{regulatoryComplianceControlName}" + + "/regulatoryComplianceAssessments") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("regulatoryComplianceStandardName") String regulatoryComplianceStandardName, + @PathParam("regulatoryComplianceControlName") String regulatoryComplianceControlName, + @QueryParam("$filter") String filter, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/providers/Microsoft.Security/regulatoryComplianceStandards" + + "/{regulatoryComplianceStandardName}/regulatoryComplianceControls/{regulatoryComplianceControlName}" + + "/regulatoryComplianceAssessments/{regulatoryComplianceAssessmentName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("regulatoryComplianceStandardName") String regulatoryComplianceStandardName, + @PathParam("regulatoryComplianceControlName") String regulatoryComplianceControlName, + @PathParam("regulatoryComplianceAssessmentName") String regulatoryComplianceAssessmentName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Details and state of assessments mapped to selected regulatory compliance control. + * + * @param regulatoryComplianceStandardName Name of the regulatory compliance standard object. + * @param regulatoryComplianceControlName Name of the regulatory compliance control object. + * @param filter OData filter. Optional. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of regulatory compliance assessment response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String regulatoryComplianceStandardName, String regulatoryComplianceControlName, String filter) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (regulatoryComplianceStandardName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter regulatoryComplianceStandardName is required and cannot be null.")); + } + if (regulatoryComplianceControlName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter regulatoryComplianceControlName is required and cannot be null.")); + } + final String apiVersion = "2019-01-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + regulatoryComplianceStandardName, + regulatoryComplianceControlName, + filter, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Details and state of assessments mapped to selected regulatory compliance control. + * + * @param regulatoryComplianceStandardName Name of the regulatory compliance standard object. + * @param regulatoryComplianceControlName Name of the regulatory compliance control object. + * @param filter OData filter. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of regulatory compliance assessment response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String regulatoryComplianceStandardName, + String regulatoryComplianceControlName, + String filter, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (regulatoryComplianceStandardName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter regulatoryComplianceStandardName is required and cannot be null.")); + } + if (regulatoryComplianceControlName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter regulatoryComplianceControlName is required and cannot be null.")); + } + final String apiVersion = "2019-01-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + regulatoryComplianceStandardName, + regulatoryComplianceControlName, + filter, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Details and state of assessments mapped to selected regulatory compliance control. + * + * @param regulatoryComplianceStandardName Name of the regulatory compliance standard object. + * @param regulatoryComplianceControlName Name of the regulatory compliance control object. + * @param filter OData filter. Optional. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of regulatory compliance assessment response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String regulatoryComplianceStandardName, String regulatoryComplianceControlName, String filter) { + return new PagedFlux<>( + () -> listSinglePageAsync(regulatoryComplianceStandardName, regulatoryComplianceControlName, filter), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Details and state of assessments mapped to selected regulatory compliance control. + * + * @param regulatoryComplianceStandardName Name of the regulatory compliance standard object. + * @param regulatoryComplianceControlName Name of the regulatory compliance control object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of regulatory compliance assessment response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String regulatoryComplianceStandardName, String regulatoryComplianceControlName) { + final String filter = null; + return new PagedFlux<>( + () -> listSinglePageAsync(regulatoryComplianceStandardName, regulatoryComplianceControlName, filter), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Details and state of assessments mapped to selected regulatory compliance control. + * + * @param regulatoryComplianceStandardName Name of the regulatory compliance standard object. + * @param regulatoryComplianceControlName Name of the regulatory compliance control object. + * @param filter OData filter. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of regulatory compliance assessment response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String regulatoryComplianceStandardName, + String regulatoryComplianceControlName, + String filter, + Context context) { + return new PagedFlux<>( + () -> + listSinglePageAsync(regulatoryComplianceStandardName, regulatoryComplianceControlName, filter, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Details and state of assessments mapped to selected regulatory compliance control. + * + * @param regulatoryComplianceStandardName Name of the regulatory compliance standard object. + * @param regulatoryComplianceControlName Name of the regulatory compliance control object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of regulatory compliance assessment response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String regulatoryComplianceStandardName, String regulatoryComplianceControlName) { + final String filter = null; + return new PagedIterable<>( + listAsync(regulatoryComplianceStandardName, regulatoryComplianceControlName, filter)); + } + + /** + * Details and state of assessments mapped to selected regulatory compliance control. + * + * @param regulatoryComplianceStandardName Name of the regulatory compliance standard object. + * @param regulatoryComplianceControlName Name of the regulatory compliance control object. + * @param filter OData filter. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of regulatory compliance assessment response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String regulatoryComplianceStandardName, + String regulatoryComplianceControlName, + String filter, + Context context) { + return new PagedIterable<>( + listAsync(regulatoryComplianceStandardName, regulatoryComplianceControlName, filter, context)); + } + + /** + * Supported regulatory compliance details and state for selected assessment. + * + * @param regulatoryComplianceStandardName Name of the regulatory compliance standard object. + * @param regulatoryComplianceControlName Name of the regulatory compliance control object. + * @param regulatoryComplianceAssessmentName Name of the regulatory compliance assessment object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return regulatory compliance assessment details and state. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String regulatoryComplianceStandardName, + String regulatoryComplianceControlName, + String regulatoryComplianceAssessmentName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (regulatoryComplianceStandardName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter regulatoryComplianceStandardName is required and cannot be null.")); + } + if (regulatoryComplianceControlName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter regulatoryComplianceControlName is required and cannot be null.")); + } + if (regulatoryComplianceAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter regulatoryComplianceAssessmentName is required and cannot be null.")); + } + final String apiVersion = "2019-01-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + regulatoryComplianceStandardName, + regulatoryComplianceControlName, + regulatoryComplianceAssessmentName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Supported regulatory compliance details and state for selected assessment. + * + * @param regulatoryComplianceStandardName Name of the regulatory compliance standard object. + * @param regulatoryComplianceControlName Name of the regulatory compliance control object. + * @param regulatoryComplianceAssessmentName Name of the regulatory compliance assessment object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return regulatory compliance assessment details and state. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String regulatoryComplianceStandardName, + String regulatoryComplianceControlName, + String regulatoryComplianceAssessmentName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (regulatoryComplianceStandardName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter regulatoryComplianceStandardName is required and cannot be null.")); + } + if (regulatoryComplianceControlName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter regulatoryComplianceControlName is required and cannot be null.")); + } + if (regulatoryComplianceAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter regulatoryComplianceAssessmentName is required and cannot be null.")); + } + final String apiVersion = "2019-01-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + regulatoryComplianceStandardName, + regulatoryComplianceControlName, + regulatoryComplianceAssessmentName, + accept, + context); + } + + /** + * Supported regulatory compliance details and state for selected assessment. + * + * @param regulatoryComplianceStandardName Name of the regulatory compliance standard object. + * @param regulatoryComplianceControlName Name of the regulatory compliance control object. + * @param regulatoryComplianceAssessmentName Name of the regulatory compliance assessment object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return regulatory compliance assessment details and state. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String regulatoryComplianceStandardName, + String regulatoryComplianceControlName, + String regulatoryComplianceAssessmentName) { + return getWithResponseAsync( + regulatoryComplianceStandardName, regulatoryComplianceControlName, regulatoryComplianceAssessmentName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Supported regulatory compliance details and state for selected assessment. + * + * @param regulatoryComplianceStandardName Name of the regulatory compliance standard object. + * @param regulatoryComplianceControlName Name of the regulatory compliance control object. + * @param regulatoryComplianceAssessmentName Name of the regulatory compliance assessment object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return regulatory compliance assessment details and state. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RegulatoryComplianceAssessmentInner get( + String regulatoryComplianceStandardName, + String regulatoryComplianceControlName, + String regulatoryComplianceAssessmentName) { + return getAsync( + regulatoryComplianceStandardName, regulatoryComplianceControlName, regulatoryComplianceAssessmentName) + .block(); + } + + /** + * Supported regulatory compliance details and state for selected assessment. + * + * @param regulatoryComplianceStandardName Name of the regulatory compliance standard object. + * @param regulatoryComplianceControlName Name of the regulatory compliance control object. + * @param regulatoryComplianceAssessmentName Name of the regulatory compliance assessment object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return regulatory compliance assessment details and state. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String regulatoryComplianceStandardName, + String regulatoryComplianceControlName, + String regulatoryComplianceAssessmentName, + Context context) { + return getWithResponseAsync( + regulatoryComplianceStandardName, + regulatoryComplianceControlName, + regulatoryComplianceAssessmentName, + context) + .block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of regulatory compliance assessment response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of regulatory compliance assessment response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/RegulatoryComplianceAssessmentsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/RegulatoryComplianceAssessmentsImpl.java new file mode 100644 index 000000000000..cbade9883c60 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/RegulatoryComplianceAssessmentsImpl.java @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.RegulatoryComplianceAssessmentsClient; +import com.azure.resourcemanager.security.fluent.models.RegulatoryComplianceAssessmentInner; +import com.azure.resourcemanager.security.models.RegulatoryComplianceAssessment; +import com.azure.resourcemanager.security.models.RegulatoryComplianceAssessments; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class RegulatoryComplianceAssessmentsImpl implements RegulatoryComplianceAssessments { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RegulatoryComplianceAssessmentsImpl.class); + + private final RegulatoryComplianceAssessmentsClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public RegulatoryComplianceAssessmentsImpl( + RegulatoryComplianceAssessmentsClient innerClient, + com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list( + String regulatoryComplianceStandardName, String regulatoryComplianceControlName) { + PagedIterable inner = + this.serviceClient().list(regulatoryComplianceStandardName, regulatoryComplianceControlName); + return Utils.mapPage(inner, inner1 -> new RegulatoryComplianceAssessmentImpl(inner1, this.manager())); + } + + public PagedIterable list( + String regulatoryComplianceStandardName, + String regulatoryComplianceControlName, + String filter, + Context context) { + PagedIterable inner = + this + .serviceClient() + .list(regulatoryComplianceStandardName, regulatoryComplianceControlName, filter, context); + return Utils.mapPage(inner, inner1 -> new RegulatoryComplianceAssessmentImpl(inner1, this.manager())); + } + + public RegulatoryComplianceAssessment get( + String regulatoryComplianceStandardName, + String regulatoryComplianceControlName, + String regulatoryComplianceAssessmentName) { + RegulatoryComplianceAssessmentInner inner = + this + .serviceClient() + .get( + regulatoryComplianceStandardName, + regulatoryComplianceControlName, + regulatoryComplianceAssessmentName); + if (inner != null) { + return new RegulatoryComplianceAssessmentImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String regulatoryComplianceStandardName, + String regulatoryComplianceControlName, + String regulatoryComplianceAssessmentName, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse( + regulatoryComplianceStandardName, + regulatoryComplianceControlName, + regulatoryComplianceAssessmentName, + context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new RegulatoryComplianceAssessmentImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private RegulatoryComplianceAssessmentsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/RegulatoryComplianceControlImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/RegulatoryComplianceControlImpl.java new file mode 100644 index 000000000000..b51b1ed37d11 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/RegulatoryComplianceControlImpl.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.resourcemanager.security.fluent.models.RegulatoryComplianceControlInner; +import com.azure.resourcemanager.security.models.RegulatoryComplianceControl; +import com.azure.resourcemanager.security.models.State; + +public final class RegulatoryComplianceControlImpl implements RegulatoryComplianceControl { + private RegulatoryComplianceControlInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + RegulatoryComplianceControlImpl( + RegulatoryComplianceControlInner innerObject, + com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String description() { + return this.innerModel().description(); + } + + public State state() { + return this.innerModel().state(); + } + + public Integer passedAssessments() { + return this.innerModel().passedAssessments(); + } + + public Integer failedAssessments() { + return this.innerModel().failedAssessments(); + } + + public Integer skippedAssessments() { + return this.innerModel().skippedAssessments(); + } + + public RegulatoryComplianceControlInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/RegulatoryComplianceControlsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/RegulatoryComplianceControlsClientImpl.java new file mode 100644 index 000000000000..6f0fd8d2bc8c --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/RegulatoryComplianceControlsClientImpl.java @@ -0,0 +1,537 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.RegulatoryComplianceControlsClient; +import com.azure.resourcemanager.security.fluent.models.RegulatoryComplianceControlInner; +import com.azure.resourcemanager.security.models.RegulatoryComplianceControlList; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in RegulatoryComplianceControlsClient. */ +public final class RegulatoryComplianceControlsClientImpl implements RegulatoryComplianceControlsClient { + private final ClientLogger logger = new ClientLogger(RegulatoryComplianceControlsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final RegulatoryComplianceControlsService service; + + /** The service client containing this operation class. */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of RegulatoryComplianceControlsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + RegulatoryComplianceControlsClientImpl(SecurityCenterImpl client) { + this.service = + RestProxy + .create( + RegulatoryComplianceControlsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterRegulatoryComplianceControls to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityCenterRegula") + private interface RegulatoryComplianceControlsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/providers/Microsoft.Security/regulatoryComplianceStandards" + + "/{regulatoryComplianceStandardName}/regulatoryComplianceControls") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("regulatoryComplianceStandardName") String regulatoryComplianceStandardName, + @QueryParam("$filter") String filter, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/providers/Microsoft.Security/regulatoryComplianceStandards" + + "/{regulatoryComplianceStandardName}/regulatoryComplianceControls/{regulatoryComplianceControlName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("regulatoryComplianceStandardName") String regulatoryComplianceStandardName, + @PathParam("regulatoryComplianceControlName") String regulatoryComplianceControlName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * All supported regulatory compliance controls details and state for selected standard. + * + * @param regulatoryComplianceStandardName Name of the regulatory compliance standard object. + * @param filter OData filter. Optional. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of regulatory compliance controls response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String regulatoryComplianceStandardName, String filter) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (regulatoryComplianceStandardName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter regulatoryComplianceStandardName is required and cannot be null.")); + } + final String apiVersion = "2019-01-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + regulatoryComplianceStandardName, + filter, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * All supported regulatory compliance controls details and state for selected standard. + * + * @param regulatoryComplianceStandardName Name of the regulatory compliance standard object. + * @param filter OData filter. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of regulatory compliance controls response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String regulatoryComplianceStandardName, String filter, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (regulatoryComplianceStandardName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter regulatoryComplianceStandardName is required and cannot be null.")); + } + final String apiVersion = "2019-01-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + regulatoryComplianceStandardName, + filter, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * All supported regulatory compliance controls details and state for selected standard. + * + * @param regulatoryComplianceStandardName Name of the regulatory compliance standard object. + * @param filter OData filter. Optional. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of regulatory compliance controls response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String regulatoryComplianceStandardName, String filter) { + return new PagedFlux<>( + () -> listSinglePageAsync(regulatoryComplianceStandardName, filter), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * All supported regulatory compliance controls details and state for selected standard. + * + * @param regulatoryComplianceStandardName Name of the regulatory compliance standard object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of regulatory compliance controls response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String regulatoryComplianceStandardName) { + final String filter = null; + return new PagedFlux<>( + () -> listSinglePageAsync(regulatoryComplianceStandardName, filter), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * All supported regulatory compliance controls details and state for selected standard. + * + * @param regulatoryComplianceStandardName Name of the regulatory compliance standard object. + * @param filter OData filter. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of regulatory compliance controls response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String regulatoryComplianceStandardName, String filter, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(regulatoryComplianceStandardName, filter, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * All supported regulatory compliance controls details and state for selected standard. + * + * @param regulatoryComplianceStandardName Name of the regulatory compliance standard object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of regulatory compliance controls response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String regulatoryComplianceStandardName) { + final String filter = null; + return new PagedIterable<>(listAsync(regulatoryComplianceStandardName, filter)); + } + + /** + * All supported regulatory compliance controls details and state for selected standard. + * + * @param regulatoryComplianceStandardName Name of the regulatory compliance standard object. + * @param filter OData filter. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of regulatory compliance controls response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String regulatoryComplianceStandardName, String filter, Context context) { + return new PagedIterable<>(listAsync(regulatoryComplianceStandardName, filter, context)); + } + + /** + * Selected regulatory compliance control details and state. + * + * @param regulatoryComplianceStandardName Name of the regulatory compliance standard object. + * @param regulatoryComplianceControlName Name of the regulatory compliance control object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return regulatory compliance control details and state. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String regulatoryComplianceStandardName, String regulatoryComplianceControlName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (regulatoryComplianceStandardName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter regulatoryComplianceStandardName is required and cannot be null.")); + } + if (regulatoryComplianceControlName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter regulatoryComplianceControlName is required and cannot be null.")); + } + final String apiVersion = "2019-01-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + regulatoryComplianceStandardName, + regulatoryComplianceControlName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Selected regulatory compliance control details and state. + * + * @param regulatoryComplianceStandardName Name of the regulatory compliance standard object. + * @param regulatoryComplianceControlName Name of the regulatory compliance control object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return regulatory compliance control details and state. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String regulatoryComplianceStandardName, String regulatoryComplianceControlName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (regulatoryComplianceStandardName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter regulatoryComplianceStandardName is required and cannot be null.")); + } + if (regulatoryComplianceControlName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter regulatoryComplianceControlName is required and cannot be null.")); + } + final String apiVersion = "2019-01-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + regulatoryComplianceStandardName, + regulatoryComplianceControlName, + accept, + context); + } + + /** + * Selected regulatory compliance control details and state. + * + * @param regulatoryComplianceStandardName Name of the regulatory compliance standard object. + * @param regulatoryComplianceControlName Name of the regulatory compliance control object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return regulatory compliance control details and state. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String regulatoryComplianceStandardName, String regulatoryComplianceControlName) { + return getWithResponseAsync(regulatoryComplianceStandardName, regulatoryComplianceControlName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Selected regulatory compliance control details and state. + * + * @param regulatoryComplianceStandardName Name of the regulatory compliance standard object. + * @param regulatoryComplianceControlName Name of the regulatory compliance control object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return regulatory compliance control details and state. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RegulatoryComplianceControlInner get( + String regulatoryComplianceStandardName, String regulatoryComplianceControlName) { + return getAsync(regulatoryComplianceStandardName, regulatoryComplianceControlName).block(); + } + + /** + * Selected regulatory compliance control details and state. + * + * @param regulatoryComplianceStandardName Name of the regulatory compliance standard object. + * @param regulatoryComplianceControlName Name of the regulatory compliance control object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return regulatory compliance control details and state. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String regulatoryComplianceStandardName, String regulatoryComplianceControlName, Context context) { + return getWithResponseAsync(regulatoryComplianceStandardName, regulatoryComplianceControlName, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of regulatory compliance controls response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of regulatory compliance controls response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/RegulatoryComplianceControlsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/RegulatoryComplianceControlsImpl.java new file mode 100644 index 000000000000..7921fc64ebe7 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/RegulatoryComplianceControlsImpl.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.RegulatoryComplianceControlsClient; +import com.azure.resourcemanager.security.fluent.models.RegulatoryComplianceControlInner; +import com.azure.resourcemanager.security.models.RegulatoryComplianceControl; +import com.azure.resourcemanager.security.models.RegulatoryComplianceControls; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class RegulatoryComplianceControlsImpl implements RegulatoryComplianceControls { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RegulatoryComplianceControlsImpl.class); + + private final RegulatoryComplianceControlsClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public RegulatoryComplianceControlsImpl( + RegulatoryComplianceControlsClient innerClient, + com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String regulatoryComplianceStandardName) { + PagedIterable inner = + this.serviceClient().list(regulatoryComplianceStandardName); + return Utils.mapPage(inner, inner1 -> new RegulatoryComplianceControlImpl(inner1, this.manager())); + } + + public PagedIterable list( + String regulatoryComplianceStandardName, String filter, Context context) { + PagedIterable inner = + this.serviceClient().list(regulatoryComplianceStandardName, filter, context); + return Utils.mapPage(inner, inner1 -> new RegulatoryComplianceControlImpl(inner1, this.manager())); + } + + public RegulatoryComplianceControl get( + String regulatoryComplianceStandardName, String regulatoryComplianceControlName) { + RegulatoryComplianceControlInner inner = + this.serviceClient().get(regulatoryComplianceStandardName, regulatoryComplianceControlName); + if (inner != null) { + return new RegulatoryComplianceControlImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String regulatoryComplianceStandardName, String regulatoryComplianceControlName, Context context) { + Response inner = + this + .serviceClient() + .getWithResponse(regulatoryComplianceStandardName, regulatoryComplianceControlName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new RegulatoryComplianceControlImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private RegulatoryComplianceControlsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/RegulatoryComplianceStandardImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/RegulatoryComplianceStandardImpl.java new file mode 100644 index 000000000000..19762eafd251 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/RegulatoryComplianceStandardImpl.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.resourcemanager.security.fluent.models.RegulatoryComplianceStandardInner; +import com.azure.resourcemanager.security.models.RegulatoryComplianceStandard; +import com.azure.resourcemanager.security.models.State; + +public final class RegulatoryComplianceStandardImpl implements RegulatoryComplianceStandard { + private RegulatoryComplianceStandardInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + RegulatoryComplianceStandardImpl( + RegulatoryComplianceStandardInner innerObject, + com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public State state() { + return this.innerModel().state(); + } + + public Integer passedControls() { + return this.innerModel().passedControls(); + } + + public Integer failedControls() { + return this.innerModel().failedControls(); + } + + public Integer skippedControls() { + return this.innerModel().skippedControls(); + } + + public Integer unsupportedControls() { + return this.innerModel().unsupportedControls(); + } + + public RegulatoryComplianceStandardInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/RegulatoryComplianceStandardsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/RegulatoryComplianceStandardsClientImpl.java new file mode 100644 index 000000000000..03b6d94253d4 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/RegulatoryComplianceStandardsClientImpl.java @@ -0,0 +1,475 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.RegulatoryComplianceStandardsClient; +import com.azure.resourcemanager.security.fluent.models.RegulatoryComplianceStandardInner; +import com.azure.resourcemanager.security.models.RegulatoryComplianceStandardList; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in RegulatoryComplianceStandardsClient. */ +public final class RegulatoryComplianceStandardsClientImpl implements RegulatoryComplianceStandardsClient { + private final ClientLogger logger = new ClientLogger(RegulatoryComplianceStandardsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final RegulatoryComplianceStandardsService service; + + /** The service client containing this operation class. */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of RegulatoryComplianceStandardsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + RegulatoryComplianceStandardsClientImpl(SecurityCenterImpl client) { + this.service = + RestProxy + .create( + RegulatoryComplianceStandardsService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterRegulatoryComplianceStandards to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityCenterRegula") + private interface RegulatoryComplianceStandardsService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/regulatoryComplianceStandards") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("$filter") String filter, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/providers/Microsoft.Security/regulatoryComplianceStandards" + + "/{regulatoryComplianceStandardName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("regulatoryComplianceStandardName") String regulatoryComplianceStandardName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Supported regulatory compliance standards details and state. + * + * @param filter OData filter. Optional. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of regulatory compliance standards response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String filter) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2019-01-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + filter, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Supported regulatory compliance standards details and state. + * + * @param filter OData filter. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of regulatory compliance standards response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String filter, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2019-01-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), filter, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Supported regulatory compliance standards details and state. + * + * @param filter OData filter. Optional. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of regulatory compliance standards response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String filter) { + return new PagedFlux<>(() -> listSinglePageAsync(filter), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Supported regulatory compliance standards details and state. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of regulatory compliance standards response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + final String filter = null; + return new PagedFlux<>(() -> listSinglePageAsync(filter), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Supported regulatory compliance standards details and state. + * + * @param filter OData filter. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of regulatory compliance standards response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String filter, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(filter, context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Supported regulatory compliance standards details and state. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of regulatory compliance standards response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + final String filter = null; + return new PagedIterable<>(listAsync(filter)); + } + + /** + * Supported regulatory compliance standards details and state. + * + * @param filter OData filter. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of regulatory compliance standards response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String filter, Context context) { + return new PagedIterable<>(listAsync(filter, context)); + } + + /** + * Supported regulatory compliance details state for selected standard. + * + * @param regulatoryComplianceStandardName Name of the regulatory compliance standard object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return regulatory compliance standard details and state. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String regulatoryComplianceStandardName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (regulatoryComplianceStandardName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter regulatoryComplianceStandardName is required and cannot be null.")); + } + final String apiVersion = "2019-01-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + regulatoryComplianceStandardName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Supported regulatory compliance details state for selected standard. + * + * @param regulatoryComplianceStandardName Name of the regulatory compliance standard object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return regulatory compliance standard details and state. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String regulatoryComplianceStandardName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (regulatoryComplianceStandardName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter regulatoryComplianceStandardName is required and cannot be null.")); + } + final String apiVersion = "2019-01-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + regulatoryComplianceStandardName, + accept, + context); + } + + /** + * Supported regulatory compliance details state for selected standard. + * + * @param regulatoryComplianceStandardName Name of the regulatory compliance standard object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return regulatory compliance standard details and state. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String regulatoryComplianceStandardName) { + return getWithResponseAsync(regulatoryComplianceStandardName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Supported regulatory compliance details state for selected standard. + * + * @param regulatoryComplianceStandardName Name of the regulatory compliance standard object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return regulatory compliance standard details and state. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RegulatoryComplianceStandardInner get(String regulatoryComplianceStandardName) { + return getAsync(regulatoryComplianceStandardName).block(); + } + + /** + * Supported regulatory compliance details state for selected standard. + * + * @param regulatoryComplianceStandardName Name of the regulatory compliance standard object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return regulatory compliance standard details and state. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String regulatoryComplianceStandardName, Context context) { + return getWithResponseAsync(regulatoryComplianceStandardName, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of regulatory compliance standards response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of regulatory compliance standards response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/RegulatoryComplianceStandardsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/RegulatoryComplianceStandardsImpl.java new file mode 100644 index 000000000000..447a92431a96 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/RegulatoryComplianceStandardsImpl.java @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.RegulatoryComplianceStandardsClient; +import com.azure.resourcemanager.security.fluent.models.RegulatoryComplianceStandardInner; +import com.azure.resourcemanager.security.models.RegulatoryComplianceStandard; +import com.azure.resourcemanager.security.models.RegulatoryComplianceStandards; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class RegulatoryComplianceStandardsImpl implements RegulatoryComplianceStandards { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RegulatoryComplianceStandardsImpl.class); + + private final RegulatoryComplianceStandardsClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public RegulatoryComplianceStandardsImpl( + RegulatoryComplianceStandardsClient innerClient, + com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new RegulatoryComplianceStandardImpl(inner1, this.manager())); + } + + public PagedIterable list(String filter, Context context) { + PagedIterable inner = this.serviceClient().list(filter, context); + return Utils.mapPage(inner, inner1 -> new RegulatoryComplianceStandardImpl(inner1, this.manager())); + } + + public RegulatoryComplianceStandard get(String regulatoryComplianceStandardName) { + RegulatoryComplianceStandardInner inner = this.serviceClient().get(regulatoryComplianceStandardName); + if (inner != null) { + return new RegulatoryComplianceStandardImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String regulatoryComplianceStandardName, Context context) { + Response inner = + this.serviceClient().getWithResponse(regulatoryComplianceStandardName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new RegulatoryComplianceStandardImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private RegulatoryComplianceStandardsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/RuleResultsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/RuleResultsImpl.java new file mode 100644 index 000000000000..d6270d99e5de --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/RuleResultsImpl.java @@ -0,0 +1,166 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.RuleResultsInner; +import com.azure.resourcemanager.security.models.RuleResults; +import com.azure.resourcemanager.security.models.RuleResultsInput; +import com.azure.resourcemanager.security.models.RuleResultsProperties; +import java.util.List; + +public final class RuleResultsImpl implements RuleResults, RuleResults.Definition, RuleResults.Update { + private RuleResultsInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public RuleResultsProperties properties() { + return this.innerModel().properties(); + } + + public RuleResultsInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } + + private String ruleId; + + private String resourceId; + + private String createWorkspaceId; + + private RuleResultsInput createBody; + + private String updateWorkspaceId; + + private RuleResultsInput updateBody; + + public RuleResultsImpl withExistingResourceId(String resourceId) { + this.resourceId = resourceId; + return this; + } + + public RuleResults create() { + this.innerObject = + serviceManager + .serviceClient() + .getSqlVulnerabilityAssessmentBaselineRules() + .createOrUpdateWithResponse(ruleId, createWorkspaceId, resourceId, createBody, Context.NONE) + .getValue(); + return this; + } + + public RuleResults create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSqlVulnerabilityAssessmentBaselineRules() + .createOrUpdateWithResponse(ruleId, createWorkspaceId, resourceId, createBody, context) + .getValue(); + return this; + } + + RuleResultsImpl(String name, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = new RuleResultsInner(); + this.serviceManager = serviceManager; + this.ruleId = name; + this.createWorkspaceId = null; + this.createBody = new RuleResultsInput(); + } + + public RuleResultsImpl update() { + this.updateWorkspaceId = null; + this.updateBody = new RuleResultsInput(); + return this; + } + + public RuleResults apply() { + this.innerObject = + serviceManager + .serviceClient() + .getSqlVulnerabilityAssessmentBaselineRules() + .createOrUpdateWithResponse(ruleId, updateWorkspaceId, resourceId, updateBody, Context.NONE) + .getValue(); + return this; + } + + public RuleResults apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSqlVulnerabilityAssessmentBaselineRules() + .createOrUpdateWithResponse(ruleId, updateWorkspaceId, resourceId, updateBody, context) + .getValue(); + return this; + } + + RuleResultsImpl(RuleResultsInner innerObject, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.ruleId = + Utils + .getValueFromIdByParameterName( + innerObject.id(), + "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/baselineRules" + + "/{ruleId}", + "ruleId"); + this.resourceId = + Utils + .getValueFromIdByParameterName( + innerObject.id(), + "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/baselineRules" + + "/{ruleId}", + "resourceId"); + } + + public RuleResultsImpl withLatestScan(Boolean latestScan) { + if (isInCreateMode()) { + this.createBody.withLatestScan(latestScan); + return this; + } else { + this.updateBody.withLatestScan(latestScan); + return this; + } + } + + public RuleResultsImpl withResults(List> results) { + if (isInCreateMode()) { + this.createBody.withResults(results); + return this; + } else { + this.updateBody.withResults(results); + return this; + } + } + + public RuleResultsImpl withWorkspaceId(String workspaceId) { + if (isInCreateMode()) { + this.createWorkspaceId = workspaceId; + return this; + } else { + this.updateWorkspaceId = workspaceId; + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/RulesResultsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/RulesResultsImpl.java new file mode 100644 index 000000000000..d048424ac5cb --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/RulesResultsImpl.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.resourcemanager.security.fluent.models.RuleResultsInner; +import com.azure.resourcemanager.security.fluent.models.RulesResultsInner; +import com.azure.resourcemanager.security.models.RuleResults; +import com.azure.resourcemanager.security.models.RulesResults; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +public final class RulesResultsImpl implements RulesResults { + private RulesResultsInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + RulesResultsImpl(RulesResultsInner innerObject, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public List value() { + List inner = this.innerModel().value(); + if (inner != null) { + return Collections + .unmodifiableList( + inner + .stream() + .map(inner1 -> new RuleResultsImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return Collections.emptyList(); + } + } + + public RulesResultsInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ScanImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ScanImpl.java new file mode 100644 index 000000000000..d9478f1ddc00 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ScanImpl.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.resourcemanager.security.fluent.models.ScanInner; +import com.azure.resourcemanager.security.models.Scan; +import com.azure.resourcemanager.security.models.ScanProperties; + +public final class ScanImpl implements Scan { + private ScanInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + ScanImpl(ScanInner innerObject, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public ScanProperties properties() { + return this.innerModel().properties(); + } + + public ScanInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ScanResultImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ScanResultImpl.java new file mode 100644 index 000000000000..cfda06c821fe --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ScanResultImpl.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.resourcemanager.security.fluent.models.ScanResultInner; +import com.azure.resourcemanager.security.models.ScanResult; +import com.azure.resourcemanager.security.models.ScanResultProperties; + +public final class ScanResultImpl implements ScanResult { + private ScanResultInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + ScanResultImpl(ScanResultInner innerObject, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public ScanResultProperties properties() { + return this.innerModel().properties(); + } + + public ScanResultInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ScanResultsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ScanResultsImpl.java new file mode 100644 index 000000000000..0380f7db5b05 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ScanResultsImpl.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.resourcemanager.security.fluent.models.ScanResultInner; +import com.azure.resourcemanager.security.fluent.models.ScanResultsInner; +import com.azure.resourcemanager.security.models.ScanResult; +import com.azure.resourcemanager.security.models.ScanResults; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +public final class ScanResultsImpl implements ScanResults { + private ScanResultsInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + ScanResultsImpl(ScanResultsInner innerObject, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public List value() { + List inner = this.innerModel().value(); + if (inner != null) { + return Collections + .unmodifiableList( + inner + .stream() + .map(inner1 -> new ScanResultImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return Collections.emptyList(); + } + } + + public ScanResultsInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ScansImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ScansImpl.java new file mode 100644 index 000000000000..0b79bb6484c4 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ScansImpl.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.resourcemanager.security.fluent.models.ScanInner; +import com.azure.resourcemanager.security.fluent.models.ScansInner; +import com.azure.resourcemanager.security.models.Scan; +import com.azure.resourcemanager.security.models.Scans; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +public final class ScansImpl implements Scans { + private ScansInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + ScansImpl(ScansInner innerObject, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public List value() { + List inner = this.innerModel().value(); + if (inner != null) { + return Collections + .unmodifiableList( + inner.stream().map(inner1 -> new ScanImpl(inner1, this.manager())).collect(Collectors.toList())); + } else { + return Collections.emptyList(); + } + } + + public ScansInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecureScoreControlDefinitionItemImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecureScoreControlDefinitionItemImpl.java new file mode 100644 index 000000000000..0e0464933445 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecureScoreControlDefinitionItemImpl.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.resourcemanager.security.fluent.models.SecureScoreControlDefinitionItemInner; +import com.azure.resourcemanager.security.models.AzureResourceLink; +import com.azure.resourcemanager.security.models.SecureScoreControlDefinitionItem; +import com.azure.resourcemanager.security.models.SecureScoreControlDefinitionSource; +import java.util.Collections; +import java.util.List; + +public final class SecureScoreControlDefinitionItemImpl implements SecureScoreControlDefinitionItem { + private SecureScoreControlDefinitionItemInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + SecureScoreControlDefinitionItemImpl( + SecureScoreControlDefinitionItemInner innerObject, + com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String displayName() { + return this.innerModel().displayName(); + } + + public String description() { + return this.innerModel().description(); + } + + public Integer maxScore() { + return this.innerModel().maxScore(); + } + + public SecureScoreControlDefinitionSource source() { + return this.innerModel().source(); + } + + public List assessmentDefinitions() { + List inner = this.innerModel().assessmentDefinitions(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public SecureScoreControlDefinitionItemInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecureScoreControlDefinitionsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecureScoreControlDefinitionsClientImpl.java new file mode 100644 index 000000000000..9fde5d5af3ad --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecureScoreControlDefinitionsClientImpl.java @@ -0,0 +1,506 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.SecureScoreControlDefinitionsClient; +import com.azure.resourcemanager.security.fluent.models.SecureScoreControlDefinitionItemInner; +import com.azure.resourcemanager.security.models.SecureScoreControlDefinitionList; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in SecureScoreControlDefinitionsClient. */ +public final class SecureScoreControlDefinitionsClientImpl implements SecureScoreControlDefinitionsClient { + private final ClientLogger logger = new ClientLogger(SecureScoreControlDefinitionsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final SecureScoreControlDefinitionsService service; + + /** The service client containing this operation class. */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of SecureScoreControlDefinitionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SecureScoreControlDefinitionsClientImpl(SecurityCenterImpl client) { + this.service = + RestProxy + .create( + SecureScoreControlDefinitionsService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterSecureScoreControlDefinitions to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityCenterSecure") + private interface SecureScoreControlDefinitionsService { + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.Security/secureScoreControlDefinitions") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/secureScoreControlDefinitions") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscription( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List the available security controls, their assessments, and the max score. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security controls definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), apiVersion, accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List the available security controls, their assessments, and the max score. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security controls definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), apiVersion, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List the available security controls, their assessments, and the max score. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security controls definition. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List the available security controls, their assessments, and the max score. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security controls definition. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List the available security controls, their assessments, and the max score. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security controls definition. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * List the available security controls, their assessments, and the max score. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security controls definition. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * For a specified subscription, list the available security controls, their assessments, and the max score. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security controls definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listBySubscription( + this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * For a specified subscription, list the available security controls, their assessments, and the max score. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security controls definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionSinglePageAsync( + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listBySubscription(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * For a specified subscription, list the available security controls, their assessments, and the max score. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security controls definition. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listBySubscriptionAsync() { + return new PagedFlux<>( + () -> listBySubscriptionSinglePageAsync(), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * For a specified subscription, list the available security controls, their assessments, and the max score. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security controls definition. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listBySubscriptionAsync(Context context) { + return new PagedFlux<>( + () -> listBySubscriptionSinglePageAsync(context), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * For a specified subscription, list the available security controls, their assessments, and the max score. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security controls definition. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listBySubscription() { + return new PagedIterable<>(listBySubscriptionAsync()); + } + + /** + * For a specified subscription, list the available security controls, their assessments, and the max score. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security controls definition. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listBySubscription(Context context) { + return new PagedIterable<>(listBySubscriptionAsync(context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security controls definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security controls definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security controls definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync( + String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security controls definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecureScoreControlDefinitionsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecureScoreControlDefinitionsImpl.java new file mode 100644 index 000000000000..dd77189beb2c --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecureScoreControlDefinitionsImpl.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.SecureScoreControlDefinitionsClient; +import com.azure.resourcemanager.security.fluent.models.SecureScoreControlDefinitionItemInner; +import com.azure.resourcemanager.security.models.SecureScoreControlDefinitionItem; +import com.azure.resourcemanager.security.models.SecureScoreControlDefinitions; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class SecureScoreControlDefinitionsImpl implements SecureScoreControlDefinitions { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SecureScoreControlDefinitionsImpl.class); + + private final SecureScoreControlDefinitionsClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public SecureScoreControlDefinitionsImpl( + SecureScoreControlDefinitionsClient innerClient, + com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new SecureScoreControlDefinitionItemImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new SecureScoreControlDefinitionItemImpl(inner1, this.manager())); + } + + public PagedIterable listBySubscription() { + PagedIterable inner = this.serviceClient().listBySubscription(); + return Utils.mapPage(inner, inner1 -> new SecureScoreControlDefinitionItemImpl(inner1, this.manager())); + } + + public PagedIterable listBySubscription(Context context) { + PagedIterable inner = this.serviceClient().listBySubscription(context); + return Utils.mapPage(inner, inner1 -> new SecureScoreControlDefinitionItemImpl(inner1, this.manager())); + } + + private SecureScoreControlDefinitionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecureScoreControlDetailsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecureScoreControlDetailsImpl.java new file mode 100644 index 000000000000..98ebfdf2afba --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecureScoreControlDetailsImpl.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.resourcemanager.security.fluent.models.SecureScoreControlDefinitionItemInner; +import com.azure.resourcemanager.security.fluent.models.SecureScoreControlDetailsInner; +import com.azure.resourcemanager.security.models.SecureScoreControlDefinitionItem; +import com.azure.resourcemanager.security.models.SecureScoreControlDetails; + +public final class SecureScoreControlDetailsImpl implements SecureScoreControlDetails { + private SecureScoreControlDetailsInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + SecureScoreControlDetailsImpl( + SecureScoreControlDetailsInner innerObject, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String displayName() { + return this.innerModel().displayName(); + } + + public Integer healthyResourceCount() { + return this.innerModel().healthyResourceCount(); + } + + public Integer unhealthyResourceCount() { + return this.innerModel().unhealthyResourceCount(); + } + + public Integer notApplicableResourceCount() { + return this.innerModel().notApplicableResourceCount(); + } + + public Long weight() { + return this.innerModel().weight(); + } + + public SecureScoreControlDefinitionItem definition() { + SecureScoreControlDefinitionItemInner inner = this.innerModel().definition(); + if (inner != null) { + return new SecureScoreControlDefinitionItemImpl(inner, this.manager()); + } else { + return null; + } + } + + public Integer max() { + return this.innerModel().max(); + } + + public Double current() { + return this.innerModel().current(); + } + + public Double percentage() { + return this.innerModel().percentage(); + } + + public SecureScoreControlDetailsInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecureScoreControlsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecureScoreControlsClientImpl.java new file mode 100644 index 000000000000..883dfea34262 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecureScoreControlsClientImpl.java @@ -0,0 +1,615 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.SecureScoreControlsClient; +import com.azure.resourcemanager.security.fluent.models.SecureScoreControlDetailsInner; +import com.azure.resourcemanager.security.models.ExpandControlsEnum; +import com.azure.resourcemanager.security.models.SecureScoreControlList; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in SecureScoreControlsClient. */ +public final class SecureScoreControlsClientImpl implements SecureScoreControlsClient { + private final ClientLogger logger = new ClientLogger(SecureScoreControlsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final SecureScoreControlsService service; + + /** The service client containing this operation class. */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of SecureScoreControlsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SecureScoreControlsClientImpl(SecurityCenterImpl client) { + this.service = + RestProxy.create(SecureScoreControlsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterSecureScoreControls to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityCenterSecure") + private interface SecureScoreControlsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/providers/Microsoft.Security/secureScores/{secureScoreName}" + + "/secureScoreControls") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySecureScore( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("secureScoreName") String secureScoreName, + @QueryParam("$expand") ExpandControlsEnum expand, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/secureScoreControls") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("$expand") ExpandControlsEnum expand, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySecureScoreNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Get all security controls for a specific initiative within a scope. + * + * @param secureScoreName The initiative name. For the ASC Default initiative, use 'ascScore' as in the sample + * request below. + * @param expand OData expand. Optional. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all security controls for a specific initiative within a scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySecureScoreSinglePageAsync( + String secureScoreName, ExpandControlsEnum expand) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (secureScoreName == null) { + return Mono + .error(new IllegalArgumentException("Parameter secureScoreName is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listBySecureScore( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + secureScoreName, + expand, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get all security controls for a specific initiative within a scope. + * + * @param secureScoreName The initiative name. For the ASC Default initiative, use 'ascScore' as in the sample + * request below. + * @param expand OData expand. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all security controls for a specific initiative within a scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySecureScoreSinglePageAsync( + String secureScoreName, ExpandControlsEnum expand, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (secureScoreName == null) { + return Mono + .error(new IllegalArgumentException("Parameter secureScoreName is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listBySecureScore( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + secureScoreName, + expand, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get all security controls for a specific initiative within a scope. + * + * @param secureScoreName The initiative name. For the ASC Default initiative, use 'ascScore' as in the sample + * request below. + * @param expand OData expand. Optional. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all security controls for a specific initiative within a scope. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listBySecureScoreAsync( + String secureScoreName, ExpandControlsEnum expand) { + return new PagedFlux<>( + () -> listBySecureScoreSinglePageAsync(secureScoreName, expand), + nextLink -> listBySecureScoreNextSinglePageAsync(nextLink)); + } + + /** + * Get all security controls for a specific initiative within a scope. + * + * @param secureScoreName The initiative name. For the ASC Default initiative, use 'ascScore' as in the sample + * request below. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all security controls for a specific initiative within a scope. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listBySecureScoreAsync(String secureScoreName) { + final ExpandControlsEnum expand = null; + return new PagedFlux<>( + () -> listBySecureScoreSinglePageAsync(secureScoreName, expand), + nextLink -> listBySecureScoreNextSinglePageAsync(nextLink)); + } + + /** + * Get all security controls for a specific initiative within a scope. + * + * @param secureScoreName The initiative name. For the ASC Default initiative, use 'ascScore' as in the sample + * request below. + * @param expand OData expand. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all security controls for a specific initiative within a scope. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listBySecureScoreAsync( + String secureScoreName, ExpandControlsEnum expand, Context context) { + return new PagedFlux<>( + () -> listBySecureScoreSinglePageAsync(secureScoreName, expand, context), + nextLink -> listBySecureScoreNextSinglePageAsync(nextLink, context)); + } + + /** + * Get all security controls for a specific initiative within a scope. + * + * @param secureScoreName The initiative name. For the ASC Default initiative, use 'ascScore' as in the sample + * request below. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all security controls for a specific initiative within a scope. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listBySecureScore(String secureScoreName) { + final ExpandControlsEnum expand = null; + return new PagedIterable<>(listBySecureScoreAsync(secureScoreName, expand)); + } + + /** + * Get all security controls for a specific initiative within a scope. + * + * @param secureScoreName The initiative name. For the ASC Default initiative, use 'ascScore' as in the sample + * request below. + * @param expand OData expand. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all security controls for a specific initiative within a scope. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listBySecureScore( + String secureScoreName, ExpandControlsEnum expand, Context context) { + return new PagedIterable<>(listBySecureScoreAsync(secureScoreName, expand, context)); + } + + /** + * Get all security controls within a scope. + * + * @param expand OData expand. Optional. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all security controls within a scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(ExpandControlsEnum expand) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + expand, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get all security controls within a scope. + * + * @param expand OData expand. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all security controls within a scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + ExpandControlsEnum expand, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), expand, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get all security controls within a scope. + * + * @param expand OData expand. Optional. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all security controls within a scope. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(ExpandControlsEnum expand) { + return new PagedFlux<>(() -> listSinglePageAsync(expand), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Get all security controls within a scope. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all security controls within a scope. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + final ExpandControlsEnum expand = null; + return new PagedFlux<>(() -> listSinglePageAsync(expand), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Get all security controls within a scope. + * + * @param expand OData expand. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all security controls within a scope. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(ExpandControlsEnum expand, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(expand, context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Get all security controls within a scope. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all security controls within a scope. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + final ExpandControlsEnum expand = null; + return new PagedIterable<>(listAsync(expand)); + } + + /** + * Get all security controls within a scope. + * + * @param expand OData expand. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all security controls within a scope. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(ExpandControlsEnum expand, Context context) { + return new PagedIterable<>(listAsync(expand, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security controls. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySecureScoreNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listBySecureScoreNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security controls. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySecureScoreNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listBySecureScoreNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security controls. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security controls. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecureScoreControlsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecureScoreControlsImpl.java new file mode 100644 index 000000000000..52e5d4dde03e --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecureScoreControlsImpl.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.SecureScoreControlsClient; +import com.azure.resourcemanager.security.fluent.models.SecureScoreControlDetailsInner; +import com.azure.resourcemanager.security.models.ExpandControlsEnum; +import com.azure.resourcemanager.security.models.SecureScoreControlDetails; +import com.azure.resourcemanager.security.models.SecureScoreControls; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class SecureScoreControlsImpl implements SecureScoreControls { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SecureScoreControlsImpl.class); + + private final SecureScoreControlsClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public SecureScoreControlsImpl( + SecureScoreControlsClient innerClient, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listBySecureScore(String secureScoreName) { + PagedIterable inner = this.serviceClient().listBySecureScore(secureScoreName); + return Utils.mapPage(inner, inner1 -> new SecureScoreControlDetailsImpl(inner1, this.manager())); + } + + public PagedIterable listBySecureScore( + String secureScoreName, ExpandControlsEnum expand, Context context) { + PagedIterable inner = + this.serviceClient().listBySecureScore(secureScoreName, expand, context); + return Utils.mapPage(inner, inner1 -> new SecureScoreControlDetailsImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new SecureScoreControlDetailsImpl(inner1, this.manager())); + } + + public PagedIterable list(ExpandControlsEnum expand, Context context) { + PagedIterable inner = this.serviceClient().list(expand, context); + return Utils.mapPage(inner, inner1 -> new SecureScoreControlDetailsImpl(inner1, this.manager())); + } + + private SecureScoreControlsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecureScoreItemImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecureScoreItemImpl.java new file mode 100644 index 000000000000..b7b5a90f0ae9 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecureScoreItemImpl.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.resourcemanager.security.fluent.models.SecureScoreItemInner; +import com.azure.resourcemanager.security.models.SecureScoreItem; + +public final class SecureScoreItemImpl implements SecureScoreItem { + private SecureScoreItemInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + SecureScoreItemImpl( + SecureScoreItemInner innerObject, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String displayName() { + return this.innerModel().displayName(); + } + + public Long weight() { + return this.innerModel().weight(); + } + + public Integer max() { + return this.innerModel().max(); + } + + public Double current() { + return this.innerModel().current(); + } + + public Double percentage() { + return this.innerModel().percentage(); + } + + public SecureScoreItemInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecureScoresClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecureScoresClientImpl.java new file mode 100644 index 000000000000..ba6d03092a8f --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecureScoresClientImpl.java @@ -0,0 +1,443 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.SecureScoresClient; +import com.azure.resourcemanager.security.fluent.models.SecureScoreItemInner; +import com.azure.resourcemanager.security.models.SecureScoresList; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in SecureScoresClient. */ +public final class SecureScoresClientImpl implements SecureScoresClient { + private final ClientLogger logger = new ClientLogger(SecureScoresClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final SecureScoresService service; + + /** The service client containing this operation class. */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of SecureScoresClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SecureScoresClientImpl(SecurityCenterImpl client) { + this.service = + RestProxy.create(SecureScoresService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterSecureScores to be used by the proxy service to perform + * REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityCenterSecure") + private interface SecureScoresService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/secureScores") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/secureScores/{secureScoreName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("secureScoreName") String secureScoreName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List secure scores for all your Security Center initiatives within your current scope. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of secure scores. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List secure scores for all your Security Center initiatives within your current scope. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of secure scores. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List secure scores for all your Security Center initiatives within your current scope. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of secure scores. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List secure scores for all your Security Center initiatives within your current scope. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of secure scores. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List secure scores for all your Security Center initiatives within your current scope. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of secure scores. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * List secure scores for all your Security Center initiatives within your current scope. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of secure scores. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Get secure score for a specific Security Center initiative within your current scope. For the ASC Default + * initiative, use 'ascScore'. + * + * @param secureScoreName The initiative name. For the ASC Default initiative, use 'ascScore' as in the sample + * request below. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return secure score for a specific Security Center initiative within your current scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String secureScoreName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (secureScoreName == null) { + return Mono + .error(new IllegalArgumentException("Parameter secureScoreName is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + secureScoreName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get secure score for a specific Security Center initiative within your current scope. For the ASC Default + * initiative, use 'ascScore'. + * + * @param secureScoreName The initiative name. For the ASC Default initiative, use 'ascScore' as in the sample + * request below. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return secure score for a specific Security Center initiative within your current scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String secureScoreName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (secureScoreName == null) { + return Mono + .error(new IllegalArgumentException("Parameter secureScoreName is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + secureScoreName, + accept, + context); + } + + /** + * Get secure score for a specific Security Center initiative within your current scope. For the ASC Default + * initiative, use 'ascScore'. + * + * @param secureScoreName The initiative name. For the ASC Default initiative, use 'ascScore' as in the sample + * request below. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return secure score for a specific Security Center initiative within your current scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String secureScoreName) { + return getWithResponseAsync(secureScoreName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get secure score for a specific Security Center initiative within your current scope. For the ASC Default + * initiative, use 'ascScore'. + * + * @param secureScoreName The initiative name. For the ASC Default initiative, use 'ascScore' as in the sample + * request below. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return secure score for a specific Security Center initiative within your current scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SecureScoreItemInner get(String secureScoreName) { + return getAsync(secureScoreName).block(); + } + + /** + * Get secure score for a specific Security Center initiative within your current scope. For the ASC Default + * initiative, use 'ascScore'. + * + * @param secureScoreName The initiative name. For the ASC Default initiative, use 'ascScore' as in the sample + * request below. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return secure score for a specific Security Center initiative within your current scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String secureScoreName, Context context) { + return getWithResponseAsync(secureScoreName, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of secure scores. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of secure scores. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecureScoresImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecureScoresImpl.java new file mode 100644 index 000000000000..8b3ea8c4e196 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecureScoresImpl.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.SecureScoresClient; +import com.azure.resourcemanager.security.fluent.models.SecureScoreItemInner; +import com.azure.resourcemanager.security.models.SecureScoreItem; +import com.azure.resourcemanager.security.models.SecureScores; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class SecureScoresImpl implements SecureScores { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SecureScoresImpl.class); + + private final SecureScoresClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public SecureScoresImpl( + SecureScoresClient innerClient, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new SecureScoreItemImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new SecureScoreItemImpl(inner1, this.manager())); + } + + public SecureScoreItem get(String secureScoreName) { + SecureScoreItemInner inner = this.serviceClient().get(secureScoreName); + if (inner != null) { + return new SecureScoreItemImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse(String secureScoreName, Context context) { + Response inner = this.serviceClient().getWithResponse(secureScoreName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new SecureScoreItemImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private SecureScoresClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecurityAssessmentImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecurityAssessmentImpl.java new file mode 100644 index 000000000000..bccc29197d91 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecurityAssessmentImpl.java @@ -0,0 +1,201 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.SecurityAssessmentInner; +import com.azure.resourcemanager.security.models.AssessmentLinks; +import com.azure.resourcemanager.security.models.AssessmentStatus; +import com.azure.resourcemanager.security.models.ExpandEnum; +import com.azure.resourcemanager.security.models.ResourceDetails; +import com.azure.resourcemanager.security.models.SecurityAssessment; +import com.azure.resourcemanager.security.models.SecurityAssessmentMetadataProperties; +import com.azure.resourcemanager.security.models.SecurityAssessmentPartnerData; +import java.util.Collections; +import java.util.Map; + +public final class SecurityAssessmentImpl + implements SecurityAssessment, SecurityAssessment.Definition, SecurityAssessment.Update { + private SecurityAssessmentInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public ResourceDetails resourceDetails() { + return this.innerModel().resourceDetails(); + } + + public String displayName() { + return this.innerModel().displayName(); + } + + public AssessmentStatus status() { + return this.innerModel().status(); + } + + public Map additionalData() { + Map inner = this.innerModel().additionalData(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public AssessmentLinks links() { + return this.innerModel().links(); + } + + public SecurityAssessmentMetadataProperties metadata() { + return this.innerModel().metadata(); + } + + public SecurityAssessmentPartnerData partnersData() { + return this.innerModel().partnersData(); + } + + public SecurityAssessmentInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } + + private String resourceId; + + private String assessmentName; + + public SecurityAssessmentImpl withExistingResourceId(String resourceId) { + this.resourceId = resourceId; + return this; + } + + public SecurityAssessment create() { + this.innerObject = + serviceManager + .serviceClient() + .getAssessments() + .createOrUpdateWithResponse(resourceId, assessmentName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public SecurityAssessment create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getAssessments() + .createOrUpdateWithResponse(resourceId, assessmentName, this.innerModel(), context) + .getValue(); + return this; + } + + SecurityAssessmentImpl(String name, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = new SecurityAssessmentInner(); + this.serviceManager = serviceManager; + this.assessmentName = name; + } + + public SecurityAssessmentImpl update() { + return this; + } + + public SecurityAssessment apply() { + this.innerObject = + serviceManager + .serviceClient() + .getAssessments() + .createOrUpdateWithResponse(resourceId, assessmentName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public SecurityAssessment apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getAssessments() + .createOrUpdateWithResponse(resourceId, assessmentName, this.innerModel(), context) + .getValue(); + return this; + } + + SecurityAssessmentImpl( + SecurityAssessmentInner innerObject, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceId = + Utils + .getValueFromIdByParameterName( + innerObject.id(), + "/{resourceId}/providers/Microsoft.Security/assessments/{assessmentName}", + "resourceId"); + this.assessmentName = + Utils + .getValueFromIdByParameterName( + innerObject.id(), + "/{resourceId}/providers/Microsoft.Security/assessments/{assessmentName}", + "assessmentName"); + } + + public SecurityAssessment refresh() { + ExpandEnum localExpand = null; + this.innerObject = + serviceManager + .serviceClient() + .getAssessments() + .getWithResponse(resourceId, assessmentName, localExpand, Context.NONE) + .getValue(); + return this; + } + + public SecurityAssessment refresh(Context context) { + ExpandEnum localExpand = null; + this.innerObject = + serviceManager + .serviceClient() + .getAssessments() + .getWithResponse(resourceId, assessmentName, localExpand, context) + .getValue(); + return this; + } + + public SecurityAssessmentImpl withResourceDetails(ResourceDetails resourceDetails) { + this.innerModel().withResourceDetails(resourceDetails); + return this; + } + + public SecurityAssessmentImpl withStatus(AssessmentStatus status) { + this.innerModel().withStatus(status); + return this; + } + + public SecurityAssessmentImpl withAdditionalData(Map additionalData) { + this.innerModel().withAdditionalData(additionalData); + return this; + } + + public SecurityAssessmentImpl withMetadata(SecurityAssessmentMetadataProperties metadata) { + this.innerModel().withMetadata(metadata); + return this; + } + + public SecurityAssessmentImpl withPartnersData(SecurityAssessmentPartnerData partnersData) { + this.innerModel().withPartnersData(partnersData); + return this; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecurityAssessmentMetadataImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecurityAssessmentMetadataImpl.java new file mode 100644 index 000000000000..bec0aedd291b --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecurityAssessmentMetadataImpl.java @@ -0,0 +1,213 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.SecurityAssessmentMetadataInner; +import com.azure.resourcemanager.security.models.AssessmentType; +import com.azure.resourcemanager.security.models.Categories; +import com.azure.resourcemanager.security.models.ImplementationEffort; +import com.azure.resourcemanager.security.models.SecurityAssessmentMetadata; +import com.azure.resourcemanager.security.models.SecurityAssessmentMetadataPartnerData; +import com.azure.resourcemanager.security.models.Severity; +import com.azure.resourcemanager.security.models.Threats; +import com.azure.resourcemanager.security.models.UserImpact; +import java.util.Collections; +import java.util.List; + +public final class SecurityAssessmentMetadataImpl + implements SecurityAssessmentMetadata, SecurityAssessmentMetadata.Definition { + private SecurityAssessmentMetadataInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + SecurityAssessmentMetadataImpl( + SecurityAssessmentMetadataInner innerObject, + com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String displayName() { + return this.innerModel().displayName(); + } + + public String policyDefinitionId() { + return this.innerModel().policyDefinitionId(); + } + + public String description() { + return this.innerModel().description(); + } + + public String remediationDescription() { + return this.innerModel().remediationDescription(); + } + + public List categories() { + List inner = this.innerModel().categories(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public Severity severity() { + return this.innerModel().severity(); + } + + public UserImpact userImpact() { + return this.innerModel().userImpact(); + } + + public ImplementationEffort implementationEffort() { + return this.innerModel().implementationEffort(); + } + + public List threats() { + List inner = this.innerModel().threats(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public Boolean preview() { + return this.innerModel().preview(); + } + + public AssessmentType assessmentType() { + return this.innerModel().assessmentType(); + } + + public SecurityAssessmentMetadataPartnerData partnerData() { + return this.innerModel().partnerData(); + } + + public SecurityAssessmentMetadataInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } + + private String assessmentMetadataName; + + public SecurityAssessmentMetadata create() { + this.innerObject = + serviceManager + .serviceClient() + .getAssessmentsMetadatas() + .createInSubscriptionWithResponse(assessmentMetadataName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public SecurityAssessmentMetadata create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getAssessmentsMetadatas() + .createInSubscriptionWithResponse(assessmentMetadataName, this.innerModel(), context) + .getValue(); + return this; + } + + SecurityAssessmentMetadataImpl(String name, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = new SecurityAssessmentMetadataInner(); + this.serviceManager = serviceManager; + this.assessmentMetadataName = name; + } + + public SecurityAssessmentMetadata refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getAssessmentsMetadatas() + .getInSubscriptionWithResponse(assessmentMetadataName, Context.NONE) + .getValue(); + return this; + } + + public SecurityAssessmentMetadata refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getAssessmentsMetadatas() + .getInSubscriptionWithResponse(assessmentMetadataName, context) + .getValue(); + return this; + } + + public SecurityAssessmentMetadataImpl withDisplayName(String displayName) { + this.innerModel().withDisplayName(displayName); + return this; + } + + public SecurityAssessmentMetadataImpl withDescription(String description) { + this.innerModel().withDescription(description); + return this; + } + + public SecurityAssessmentMetadataImpl withRemediationDescription(String remediationDescription) { + this.innerModel().withRemediationDescription(remediationDescription); + return this; + } + + public SecurityAssessmentMetadataImpl withCategories(List categories) { + this.innerModel().withCategories(categories); + return this; + } + + public SecurityAssessmentMetadataImpl withSeverity(Severity severity) { + this.innerModel().withSeverity(severity); + return this; + } + + public SecurityAssessmentMetadataImpl withUserImpact(UserImpact userImpact) { + this.innerModel().withUserImpact(userImpact); + return this; + } + + public SecurityAssessmentMetadataImpl withImplementationEffort(ImplementationEffort implementationEffort) { + this.innerModel().withImplementationEffort(implementationEffort); + return this; + } + + public SecurityAssessmentMetadataImpl withThreats(List threats) { + this.innerModel().withThreats(threats); + return this; + } + + public SecurityAssessmentMetadataImpl withPreview(Boolean preview) { + this.innerModel().withPreview(preview); + return this; + } + + public SecurityAssessmentMetadataImpl withAssessmentType(AssessmentType assessmentType) { + this.innerModel().withAssessmentType(assessmentType); + return this; + } + + public SecurityAssessmentMetadataImpl withPartnerData(SecurityAssessmentMetadataPartnerData partnerData) { + this.innerModel().withPartnerData(partnerData); + return this; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecurityCenterBuilder.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecurityCenterBuilder.java new file mode 100644 index 000000000000..f5b37326a32a --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecurityCenterBuilder.java @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.CookiePolicy; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.serializer.SerializerAdapter; +import java.time.Duration; + +/** A builder for creating a new instance of the SecurityCenterImpl type. */ +@ServiceClientBuilder(serviceClients = {SecurityCenterImpl.class}) +public final class SecurityCenterBuilder { + /* + * Azure subscription ID + */ + private String subscriptionId; + + /** + * Sets Azure subscription ID. + * + * @param subscriptionId the subscriptionId value. + * @return the SecurityCenterBuilder. + */ + public SecurityCenterBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * server parameter + */ + private String endpoint; + + /** + * Sets server parameter. + * + * @param endpoint the endpoint value. + * @return the SecurityCenterBuilder. + */ + public SecurityCenterBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The environment to connect to + */ + private AzureEnvironment environment; + + /** + * Sets The environment to connect to. + * + * @param environment the environment value. + * @return the SecurityCenterBuilder. + */ + public SecurityCenterBuilder environment(AzureEnvironment environment) { + this.environment = environment; + return this; + } + + /* + * The default poll interval for long-running operation + */ + private Duration defaultPollInterval; + + /** + * Sets The default poll interval for long-running operation. + * + * @param defaultPollInterval the defaultPollInterval value. + * @return the SecurityCenterBuilder. + */ + public SecurityCenterBuilder defaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = defaultPollInterval; + return this; + } + + /* + * The HTTP pipeline to send requests through + */ + private HttpPipeline pipeline; + + /** + * Sets The HTTP pipeline to send requests through. + * + * @param pipeline the pipeline value. + * @return the SecurityCenterBuilder. + */ + public SecurityCenterBuilder pipeline(HttpPipeline pipeline) { + this.pipeline = pipeline; + return this; + } + + /* + * The serializer to serialize an object into a string + */ + private SerializerAdapter serializerAdapter; + + /** + * Sets The serializer to serialize an object into a string. + * + * @param serializerAdapter the serializerAdapter value. + * @return the SecurityCenterBuilder. + */ + public SecurityCenterBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of SecurityCenterImpl with the provided parameters. + * + * @return an instance of SecurityCenterImpl. + */ + public SecurityCenterImpl buildClient() { + if (endpoint == null) { + this.endpoint = "https://management.azure.com"; + } + if (environment == null) { + this.environment = AzureEnvironment.AZURE; + } + if (defaultPollInterval == null) { + this.defaultPollInterval = Duration.ofSeconds(30); + } + if (pipeline == null) { + this.pipeline = + new HttpPipelineBuilder() + .policies(new UserAgentPolicy(), new RetryPolicy(), new CookiePolicy()) + .build(); + } + if (serializerAdapter == null) { + this.serializerAdapter = SerializerFactory.createDefaultManagementSerializerAdapter(); + } + SecurityCenterImpl client = + new SecurityCenterImpl( + pipeline, serializerAdapter, defaultPollInterval, environment, subscriptionId, endpoint); + return client; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecurityCenterImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecurityCenterImpl.java new file mode 100644 index 000000000000..7501c30676cf --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecurityCenterImpl.java @@ -0,0 +1,1052 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.annotation.ServiceClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.Response; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.exception.ManagementError; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.management.polling.PollerFactory; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.AsyncPollResponse; +import com.azure.core.util.polling.LongRunningOperationStatus; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.serializer.SerializerAdapter; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.security.fluent.AdaptiveApplicationControlsClient; +import com.azure.resourcemanager.security.fluent.AdaptiveNetworkHardeningsClient; +import com.azure.resourcemanager.security.fluent.AdvancedThreatProtectionsClient; +import com.azure.resourcemanager.security.fluent.AlertsClient; +import com.azure.resourcemanager.security.fluent.AlertsSuppressionRulesClient; +import com.azure.resourcemanager.security.fluent.AllowedConnectionsClient; +import com.azure.resourcemanager.security.fluent.AssessmentsClient; +import com.azure.resourcemanager.security.fluent.AssessmentsMetadatasClient; +import com.azure.resourcemanager.security.fluent.AutoProvisioningSettingsClient; +import com.azure.resourcemanager.security.fluent.AutomationsClient; +import com.azure.resourcemanager.security.fluent.ComplianceResultsClient; +import com.azure.resourcemanager.security.fluent.CompliancesClient; +import com.azure.resourcemanager.security.fluent.ConnectorsClient; +import com.azure.resourcemanager.security.fluent.DeviceSecurityGroupsClient; +import com.azure.resourcemanager.security.fluent.DevicesClient; +import com.azure.resourcemanager.security.fluent.DevicesForHubsClient; +import com.azure.resourcemanager.security.fluent.DevicesForSubscriptionsClient; +import com.azure.resourcemanager.security.fluent.DiscoveredSecuritySolutionsClient; +import com.azure.resourcemanager.security.fluent.ExternalSecuritySolutionsClient; +import com.azure.resourcemanager.security.fluent.InformationProtectionPoliciesClient; +import com.azure.resourcemanager.security.fluent.IngestionSettingsClient; +import com.azure.resourcemanager.security.fluent.IotAlertTypesClient; +import com.azure.resourcemanager.security.fluent.IotAlertsClient; +import com.azure.resourcemanager.security.fluent.IotDefenderSettingsClient; +import com.azure.resourcemanager.security.fluent.IotRecommendationTypesClient; +import com.azure.resourcemanager.security.fluent.IotRecommendationsClient; +import com.azure.resourcemanager.security.fluent.IotSecuritySolutionAnalyticsClient; +import com.azure.resourcemanager.security.fluent.IotSecuritySolutionsAnalyticsAggregatedAlertsClient; +import com.azure.resourcemanager.security.fluent.IotSecuritySolutionsAnalyticsRecommendationsClient; +import com.azure.resourcemanager.security.fluent.IotSecuritySolutionsClient; +import com.azure.resourcemanager.security.fluent.IotSensorsClient; +import com.azure.resourcemanager.security.fluent.IotSitesClient; +import com.azure.resourcemanager.security.fluent.JitNetworkAccessPoliciesClient; +import com.azure.resourcemanager.security.fluent.LocationsClient; +import com.azure.resourcemanager.security.fluent.OnPremiseIotSensorsClient; +import com.azure.resourcemanager.security.fluent.OperationsClient; +import com.azure.resourcemanager.security.fluent.PricingsClient; +import com.azure.resourcemanager.security.fluent.RegulatoryComplianceAssessmentsClient; +import com.azure.resourcemanager.security.fluent.RegulatoryComplianceControlsClient; +import com.azure.resourcemanager.security.fluent.RegulatoryComplianceStandardsClient; +import com.azure.resourcemanager.security.fluent.SecureScoreControlDefinitionsClient; +import com.azure.resourcemanager.security.fluent.SecureScoreControlsClient; +import com.azure.resourcemanager.security.fluent.SecureScoresClient; +import com.azure.resourcemanager.security.fluent.SecurityCenter; +import com.azure.resourcemanager.security.fluent.SecurityContactsClient; +import com.azure.resourcemanager.security.fluent.SecuritySolutionsClient; +import com.azure.resourcemanager.security.fluent.SecuritySolutionsReferenceDatasClient; +import com.azure.resourcemanager.security.fluent.ServerVulnerabilityAssessmentsClient; +import com.azure.resourcemanager.security.fluent.SettingsClient; +import com.azure.resourcemanager.security.fluent.SoftwareInventoriesClient; +import com.azure.resourcemanager.security.fluent.SqlVulnerabilityAssessmentBaselineRulesClient; +import com.azure.resourcemanager.security.fluent.SqlVulnerabilityAssessmentScanResultsClient; +import com.azure.resourcemanager.security.fluent.SqlVulnerabilityAssessmentScansClient; +import com.azure.resourcemanager.security.fluent.SubAssessmentsClient; +import com.azure.resourcemanager.security.fluent.TasksClient; +import com.azure.resourcemanager.security.fluent.TopologiesClient; +import com.azure.resourcemanager.security.fluent.WorkspaceSettingsClient; +import java.io.IOException; +import java.lang.reflect.Type; +import java.nio.ByteBuffer; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.time.Duration; +import java.util.Map; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** Initializes a new instance of the SecurityCenterImpl type. */ +@ServiceClient(builder = SecurityCenterBuilder.class) +public final class SecurityCenterImpl implements SecurityCenter { + private final ClientLogger logger = new ClientLogger(SecurityCenterImpl.class); + + /** Azure subscription ID. */ + private final String subscriptionId; + + /** + * Gets Azure subscription ID. + * + * @return the subscriptionId value. + */ + public String getSubscriptionId() { + return this.subscriptionId; + } + + /** server parameter. */ + private final String endpoint; + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** The HTTP pipeline to send requests through. */ + private final HttpPipeline httpPipeline; + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + public HttpPipeline getHttpPipeline() { + return this.httpPipeline; + } + + /** The serializer to serialize an object into a string. */ + private final SerializerAdapter serializerAdapter; + + /** + * Gets The serializer to serialize an object into a string. + * + * @return the serializerAdapter value. + */ + SerializerAdapter getSerializerAdapter() { + return this.serializerAdapter; + } + + /** The default poll interval for long-running operation. */ + private final Duration defaultPollInterval; + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + public Duration getDefaultPollInterval() { + return this.defaultPollInterval; + } + + /** The ComplianceResultsClient object to access its operations. */ + private final ComplianceResultsClient complianceResults; + + /** + * Gets the ComplianceResultsClient object to access its operations. + * + * @return the ComplianceResultsClient object. + */ + public ComplianceResultsClient getComplianceResults() { + return this.complianceResults; + } + + /** The PricingsClient object to access its operations. */ + private final PricingsClient pricings; + + /** + * Gets the PricingsClient object to access its operations. + * + * @return the PricingsClient object. + */ + public PricingsClient getPricings() { + return this.pricings; + } + + /** The AdvancedThreatProtectionsClient object to access its operations. */ + private final AdvancedThreatProtectionsClient advancedThreatProtections; + + /** + * Gets the AdvancedThreatProtectionsClient object to access its operations. + * + * @return the AdvancedThreatProtectionsClient object. + */ + public AdvancedThreatProtectionsClient getAdvancedThreatProtections() { + return this.advancedThreatProtections; + } + + /** The DeviceSecurityGroupsClient object to access its operations. */ + private final DeviceSecurityGroupsClient deviceSecurityGroups; + + /** + * Gets the DeviceSecurityGroupsClient object to access its operations. + * + * @return the DeviceSecurityGroupsClient object. + */ + public DeviceSecurityGroupsClient getDeviceSecurityGroups() { + return this.deviceSecurityGroups; + } + + /** The IotSecuritySolutionsClient object to access its operations. */ + private final IotSecuritySolutionsClient iotSecuritySolutions; + + /** + * Gets the IotSecuritySolutionsClient object to access its operations. + * + * @return the IotSecuritySolutionsClient object. + */ + public IotSecuritySolutionsClient getIotSecuritySolutions() { + return this.iotSecuritySolutions; + } + + /** The IotSecuritySolutionAnalyticsClient object to access its operations. */ + private final IotSecuritySolutionAnalyticsClient iotSecuritySolutionAnalytics; + + /** + * Gets the IotSecuritySolutionAnalyticsClient object to access its operations. + * + * @return the IotSecuritySolutionAnalyticsClient object. + */ + public IotSecuritySolutionAnalyticsClient getIotSecuritySolutionAnalytics() { + return this.iotSecuritySolutionAnalytics; + } + + /** The IotSecuritySolutionsAnalyticsAggregatedAlertsClient object to access its operations. */ + private final IotSecuritySolutionsAnalyticsAggregatedAlertsClient iotSecuritySolutionsAnalyticsAggregatedAlerts; + + /** + * Gets the IotSecuritySolutionsAnalyticsAggregatedAlertsClient object to access its operations. + * + * @return the IotSecuritySolutionsAnalyticsAggregatedAlertsClient object. + */ + public IotSecuritySolutionsAnalyticsAggregatedAlertsClient getIotSecuritySolutionsAnalyticsAggregatedAlerts() { + return this.iotSecuritySolutionsAnalyticsAggregatedAlerts; + } + + /** The IotSecuritySolutionsAnalyticsRecommendationsClient object to access its operations. */ + private final IotSecuritySolutionsAnalyticsRecommendationsClient iotSecuritySolutionsAnalyticsRecommendations; + + /** + * Gets the IotSecuritySolutionsAnalyticsRecommendationsClient object to access its operations. + * + * @return the IotSecuritySolutionsAnalyticsRecommendationsClient object. + */ + public IotSecuritySolutionsAnalyticsRecommendationsClient getIotSecuritySolutionsAnalyticsRecommendations() { + return this.iotSecuritySolutionsAnalyticsRecommendations; + } + + /** The LocationsClient object to access its operations. */ + private final LocationsClient locations; + + /** + * Gets the LocationsClient object to access its operations. + * + * @return the LocationsClient object. + */ + public LocationsClient getLocations() { + return this.locations; + } + + /** The OperationsClient object to access its operations. */ + private final OperationsClient operations; + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + public OperationsClient getOperations() { + return this.operations; + } + + /** The TasksClient object to access its operations. */ + private final TasksClient tasks; + + /** + * Gets the TasksClient object to access its operations. + * + * @return the TasksClient object. + */ + public TasksClient getTasks() { + return this.tasks; + } + + /** The AutoProvisioningSettingsClient object to access its operations. */ + private final AutoProvisioningSettingsClient autoProvisioningSettings; + + /** + * Gets the AutoProvisioningSettingsClient object to access its operations. + * + * @return the AutoProvisioningSettingsClient object. + */ + public AutoProvisioningSettingsClient getAutoProvisioningSettings() { + return this.autoProvisioningSettings; + } + + /** The CompliancesClient object to access its operations. */ + private final CompliancesClient compliances; + + /** + * Gets the CompliancesClient object to access its operations. + * + * @return the CompliancesClient object. + */ + public CompliancesClient getCompliances() { + return this.compliances; + } + + /** The InformationProtectionPoliciesClient object to access its operations. */ + private final InformationProtectionPoliciesClient informationProtectionPolicies; + + /** + * Gets the InformationProtectionPoliciesClient object to access its operations. + * + * @return the InformationProtectionPoliciesClient object. + */ + public InformationProtectionPoliciesClient getInformationProtectionPolicies() { + return this.informationProtectionPolicies; + } + + /** The SecurityContactsClient object to access its operations. */ + private final SecurityContactsClient securityContacts; + + /** + * Gets the SecurityContactsClient object to access its operations. + * + * @return the SecurityContactsClient object. + */ + public SecurityContactsClient getSecurityContacts() { + return this.securityContacts; + } + + /** The WorkspaceSettingsClient object to access its operations. */ + private final WorkspaceSettingsClient workspaceSettings; + + /** + * Gets the WorkspaceSettingsClient object to access its operations. + * + * @return the WorkspaceSettingsClient object. + */ + public WorkspaceSettingsClient getWorkspaceSettings() { + return this.workspaceSettings; + } + + /** The RegulatoryComplianceStandardsClient object to access its operations. */ + private final RegulatoryComplianceStandardsClient regulatoryComplianceStandards; + + /** + * Gets the RegulatoryComplianceStandardsClient object to access its operations. + * + * @return the RegulatoryComplianceStandardsClient object. + */ + public RegulatoryComplianceStandardsClient getRegulatoryComplianceStandards() { + return this.regulatoryComplianceStandards; + } + + /** The RegulatoryComplianceControlsClient object to access its operations. */ + private final RegulatoryComplianceControlsClient regulatoryComplianceControls; + + /** + * Gets the RegulatoryComplianceControlsClient object to access its operations. + * + * @return the RegulatoryComplianceControlsClient object. + */ + public RegulatoryComplianceControlsClient getRegulatoryComplianceControls() { + return this.regulatoryComplianceControls; + } + + /** The RegulatoryComplianceAssessmentsClient object to access its operations. */ + private final RegulatoryComplianceAssessmentsClient regulatoryComplianceAssessments; + + /** + * Gets the RegulatoryComplianceAssessmentsClient object to access its operations. + * + * @return the RegulatoryComplianceAssessmentsClient object. + */ + public RegulatoryComplianceAssessmentsClient getRegulatoryComplianceAssessments() { + return this.regulatoryComplianceAssessments; + } + + /** The SubAssessmentsClient object to access its operations. */ + private final SubAssessmentsClient subAssessments; + + /** + * Gets the SubAssessmentsClient object to access its operations. + * + * @return the SubAssessmentsClient object. + */ + public SubAssessmentsClient getSubAssessments() { + return this.subAssessments; + } + + /** The AutomationsClient object to access its operations. */ + private final AutomationsClient automations; + + /** + * Gets the AutomationsClient object to access its operations. + * + * @return the AutomationsClient object. + */ + public AutomationsClient getAutomations() { + return this.automations; + } + + /** The AlertsSuppressionRulesClient object to access its operations. */ + private final AlertsSuppressionRulesClient alertsSuppressionRules; + + /** + * Gets the AlertsSuppressionRulesClient object to access its operations. + * + * @return the AlertsSuppressionRulesClient object. + */ + public AlertsSuppressionRulesClient getAlertsSuppressionRules() { + return this.alertsSuppressionRules; + } + + /** The ServerVulnerabilityAssessmentsClient object to access its operations. */ + private final ServerVulnerabilityAssessmentsClient serverVulnerabilityAssessments; + + /** + * Gets the ServerVulnerabilityAssessmentsClient object to access its operations. + * + * @return the ServerVulnerabilityAssessmentsClient object. + */ + public ServerVulnerabilityAssessmentsClient getServerVulnerabilityAssessments() { + return this.serverVulnerabilityAssessments; + } + + /** The AssessmentsMetadatasClient object to access its operations. */ + private final AssessmentsMetadatasClient assessmentsMetadatas; + + /** + * Gets the AssessmentsMetadatasClient object to access its operations. + * + * @return the AssessmentsMetadatasClient object. + */ + public AssessmentsMetadatasClient getAssessmentsMetadatas() { + return this.assessmentsMetadatas; + } + + /** The AssessmentsClient object to access its operations. */ + private final AssessmentsClient assessments; + + /** + * Gets the AssessmentsClient object to access its operations. + * + * @return the AssessmentsClient object. + */ + public AssessmentsClient getAssessments() { + return this.assessments; + } + + /** The AdaptiveApplicationControlsClient object to access its operations. */ + private final AdaptiveApplicationControlsClient adaptiveApplicationControls; + + /** + * Gets the AdaptiveApplicationControlsClient object to access its operations. + * + * @return the AdaptiveApplicationControlsClient object. + */ + public AdaptiveApplicationControlsClient getAdaptiveApplicationControls() { + return this.adaptiveApplicationControls; + } + + /** The AdaptiveNetworkHardeningsClient object to access its operations. */ + private final AdaptiveNetworkHardeningsClient adaptiveNetworkHardenings; + + /** + * Gets the AdaptiveNetworkHardeningsClient object to access its operations. + * + * @return the AdaptiveNetworkHardeningsClient object. + */ + public AdaptiveNetworkHardeningsClient getAdaptiveNetworkHardenings() { + return this.adaptiveNetworkHardenings; + } + + /** The AllowedConnectionsClient object to access its operations. */ + private final AllowedConnectionsClient allowedConnections; + + /** + * Gets the AllowedConnectionsClient object to access its operations. + * + * @return the AllowedConnectionsClient object. + */ + public AllowedConnectionsClient getAllowedConnections() { + return this.allowedConnections; + } + + /** The TopologiesClient object to access its operations. */ + private final TopologiesClient topologies; + + /** + * Gets the TopologiesClient object to access its operations. + * + * @return the TopologiesClient object. + */ + public TopologiesClient getTopologies() { + return this.topologies; + } + + /** The JitNetworkAccessPoliciesClient object to access its operations. */ + private final JitNetworkAccessPoliciesClient jitNetworkAccessPolicies; + + /** + * Gets the JitNetworkAccessPoliciesClient object to access its operations. + * + * @return the JitNetworkAccessPoliciesClient object. + */ + public JitNetworkAccessPoliciesClient getJitNetworkAccessPolicies() { + return this.jitNetworkAccessPolicies; + } + + /** The DiscoveredSecuritySolutionsClient object to access its operations. */ + private final DiscoveredSecuritySolutionsClient discoveredSecuritySolutions; + + /** + * Gets the DiscoveredSecuritySolutionsClient object to access its operations. + * + * @return the DiscoveredSecuritySolutionsClient object. + */ + public DiscoveredSecuritySolutionsClient getDiscoveredSecuritySolutions() { + return this.discoveredSecuritySolutions; + } + + /** The SecuritySolutionsReferenceDatasClient object to access its operations. */ + private final SecuritySolutionsReferenceDatasClient securitySolutionsReferenceDatas; + + /** + * Gets the SecuritySolutionsReferenceDatasClient object to access its operations. + * + * @return the SecuritySolutionsReferenceDatasClient object. + */ + public SecuritySolutionsReferenceDatasClient getSecuritySolutionsReferenceDatas() { + return this.securitySolutionsReferenceDatas; + } + + /** The ExternalSecuritySolutionsClient object to access its operations. */ + private final ExternalSecuritySolutionsClient externalSecuritySolutions; + + /** + * Gets the ExternalSecuritySolutionsClient object to access its operations. + * + * @return the ExternalSecuritySolutionsClient object. + */ + public ExternalSecuritySolutionsClient getExternalSecuritySolutions() { + return this.externalSecuritySolutions; + } + + /** The SecureScoresClient object to access its operations. */ + private final SecureScoresClient secureScores; + + /** + * Gets the SecureScoresClient object to access its operations. + * + * @return the SecureScoresClient object. + */ + public SecureScoresClient getSecureScores() { + return this.secureScores; + } + + /** The SecureScoreControlsClient object to access its operations. */ + private final SecureScoreControlsClient secureScoreControls; + + /** + * Gets the SecureScoreControlsClient object to access its operations. + * + * @return the SecureScoreControlsClient object. + */ + public SecureScoreControlsClient getSecureScoreControls() { + return this.secureScoreControls; + } + + /** The SecureScoreControlDefinitionsClient object to access its operations. */ + private final SecureScoreControlDefinitionsClient secureScoreControlDefinitions; + + /** + * Gets the SecureScoreControlDefinitionsClient object to access its operations. + * + * @return the SecureScoreControlDefinitionsClient object. + */ + public SecureScoreControlDefinitionsClient getSecureScoreControlDefinitions() { + return this.secureScoreControlDefinitions; + } + + /** The SecuritySolutionsClient object to access its operations. */ + private final SecuritySolutionsClient securitySolutions; + + /** + * Gets the SecuritySolutionsClient object to access its operations. + * + * @return the SecuritySolutionsClient object. + */ + public SecuritySolutionsClient getSecuritySolutions() { + return this.securitySolutions; + } + + /** The ConnectorsClient object to access its operations. */ + private final ConnectorsClient connectors; + + /** + * Gets the ConnectorsClient object to access its operations. + * + * @return the ConnectorsClient object. + */ + public ConnectorsClient getConnectors() { + return this.connectors; + } + + /** The SqlVulnerabilityAssessmentScansClient object to access its operations. */ + private final SqlVulnerabilityAssessmentScansClient sqlVulnerabilityAssessmentScans; + + /** + * Gets the SqlVulnerabilityAssessmentScansClient object to access its operations. + * + * @return the SqlVulnerabilityAssessmentScansClient object. + */ + public SqlVulnerabilityAssessmentScansClient getSqlVulnerabilityAssessmentScans() { + return this.sqlVulnerabilityAssessmentScans; + } + + /** The SqlVulnerabilityAssessmentScanResultsClient object to access its operations. */ + private final SqlVulnerabilityAssessmentScanResultsClient sqlVulnerabilityAssessmentScanResults; + + /** + * Gets the SqlVulnerabilityAssessmentScanResultsClient object to access its operations. + * + * @return the SqlVulnerabilityAssessmentScanResultsClient object. + */ + public SqlVulnerabilityAssessmentScanResultsClient getSqlVulnerabilityAssessmentScanResults() { + return this.sqlVulnerabilityAssessmentScanResults; + } + + /** The SqlVulnerabilityAssessmentBaselineRulesClient object to access its operations. */ + private final SqlVulnerabilityAssessmentBaselineRulesClient sqlVulnerabilityAssessmentBaselineRules; + + /** + * Gets the SqlVulnerabilityAssessmentBaselineRulesClient object to access its operations. + * + * @return the SqlVulnerabilityAssessmentBaselineRulesClient object. + */ + public SqlVulnerabilityAssessmentBaselineRulesClient getSqlVulnerabilityAssessmentBaselineRules() { + return this.sqlVulnerabilityAssessmentBaselineRules; + } + + /** The IotDefenderSettingsClient object to access its operations. */ + private final IotDefenderSettingsClient iotDefenderSettings; + + /** + * Gets the IotDefenderSettingsClient object to access its operations. + * + * @return the IotDefenderSettingsClient object. + */ + public IotDefenderSettingsClient getIotDefenderSettings() { + return this.iotDefenderSettings; + } + + /** The IotSensorsClient object to access its operations. */ + private final IotSensorsClient iotSensors; + + /** + * Gets the IotSensorsClient object to access its operations. + * + * @return the IotSensorsClient object. + */ + public IotSensorsClient getIotSensors() { + return this.iotSensors; + } + + /** The DevicesForSubscriptionsClient object to access its operations. */ + private final DevicesForSubscriptionsClient devicesForSubscriptions; + + /** + * Gets the DevicesForSubscriptionsClient object to access its operations. + * + * @return the DevicesForSubscriptionsClient object. + */ + public DevicesForSubscriptionsClient getDevicesForSubscriptions() { + return this.devicesForSubscriptions; + } + + /** The DevicesForHubsClient object to access its operations. */ + private final DevicesForHubsClient devicesForHubs; + + /** + * Gets the DevicesForHubsClient object to access its operations. + * + * @return the DevicesForHubsClient object. + */ + public DevicesForHubsClient getDevicesForHubs() { + return this.devicesForHubs; + } + + /** The DevicesClient object to access its operations. */ + private final DevicesClient devices; + + /** + * Gets the DevicesClient object to access its operations. + * + * @return the DevicesClient object. + */ + public DevicesClient getDevices() { + return this.devices; + } + + /** The OnPremiseIotSensorsClient object to access its operations. */ + private final OnPremiseIotSensorsClient onPremiseIotSensors; + + /** + * Gets the OnPremiseIotSensorsClient object to access its operations. + * + * @return the OnPremiseIotSensorsClient object. + */ + public OnPremiseIotSensorsClient getOnPremiseIotSensors() { + return this.onPremiseIotSensors; + } + + /** The IotSitesClient object to access its operations. */ + private final IotSitesClient iotSites; + + /** + * Gets the IotSitesClient object to access its operations. + * + * @return the IotSitesClient object. + */ + public IotSitesClient getIotSites() { + return this.iotSites; + } + + /** The IotAlertsClient object to access its operations. */ + private final IotAlertsClient iotAlerts; + + /** + * Gets the IotAlertsClient object to access its operations. + * + * @return the IotAlertsClient object. + */ + public IotAlertsClient getIotAlerts() { + return this.iotAlerts; + } + + /** The IotAlertTypesClient object to access its operations. */ + private final IotAlertTypesClient iotAlertTypes; + + /** + * Gets the IotAlertTypesClient object to access its operations. + * + * @return the IotAlertTypesClient object. + */ + public IotAlertTypesClient getIotAlertTypes() { + return this.iotAlertTypes; + } + + /** The IotRecommendationsClient object to access its operations. */ + private final IotRecommendationsClient iotRecommendations; + + /** + * Gets the IotRecommendationsClient object to access its operations. + * + * @return the IotRecommendationsClient object. + */ + public IotRecommendationsClient getIotRecommendations() { + return this.iotRecommendations; + } + + /** The IotRecommendationTypesClient object to access its operations. */ + private final IotRecommendationTypesClient iotRecommendationTypes; + + /** + * Gets the IotRecommendationTypesClient object to access its operations. + * + * @return the IotRecommendationTypesClient object. + */ + public IotRecommendationTypesClient getIotRecommendationTypes() { + return this.iotRecommendationTypes; + } + + /** The AlertsClient object to access its operations. */ + private final AlertsClient alerts; + + /** + * Gets the AlertsClient object to access its operations. + * + * @return the AlertsClient object. + */ + public AlertsClient getAlerts() { + return this.alerts; + } + + /** The SettingsClient object to access its operations. */ + private final SettingsClient settings; + + /** + * Gets the SettingsClient object to access its operations. + * + * @return the SettingsClient object. + */ + public SettingsClient getSettings() { + return this.settings; + } + + /** The IngestionSettingsClient object to access its operations. */ + private final IngestionSettingsClient ingestionSettings; + + /** + * Gets the IngestionSettingsClient object to access its operations. + * + * @return the IngestionSettingsClient object. + */ + public IngestionSettingsClient getIngestionSettings() { + return this.ingestionSettings; + } + + /** The SoftwareInventoriesClient object to access its operations. */ + private final SoftwareInventoriesClient softwareInventories; + + /** + * Gets the SoftwareInventoriesClient object to access its operations. + * + * @return the SoftwareInventoriesClient object. + */ + public SoftwareInventoriesClient getSoftwareInventories() { + return this.softwareInventories; + } + + /** + * Initializes an instance of SecurityCenter client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param defaultPollInterval The default poll interval for long-running operation. + * @param environment The Azure environment. + * @param subscriptionId Azure subscription ID. + * @param endpoint server parameter. + */ + SecurityCenterImpl( + HttpPipeline httpPipeline, + SerializerAdapter serializerAdapter, + Duration defaultPollInterval, + AzureEnvironment environment, + String subscriptionId, + String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.defaultPollInterval = defaultPollInterval; + this.subscriptionId = subscriptionId; + this.endpoint = endpoint; + this.complianceResults = new ComplianceResultsClientImpl(this); + this.pricings = new PricingsClientImpl(this); + this.advancedThreatProtections = new AdvancedThreatProtectionsClientImpl(this); + this.deviceSecurityGroups = new DeviceSecurityGroupsClientImpl(this); + this.iotSecuritySolutions = new IotSecuritySolutionsClientImpl(this); + this.iotSecuritySolutionAnalytics = new IotSecuritySolutionAnalyticsClientImpl(this); + this.iotSecuritySolutionsAnalyticsAggregatedAlerts = + new IotSecuritySolutionsAnalyticsAggregatedAlertsClientImpl(this); + this.iotSecuritySolutionsAnalyticsRecommendations = + new IotSecuritySolutionsAnalyticsRecommendationsClientImpl(this); + this.locations = new LocationsClientImpl(this); + this.operations = new OperationsClientImpl(this); + this.tasks = new TasksClientImpl(this); + this.autoProvisioningSettings = new AutoProvisioningSettingsClientImpl(this); + this.compliances = new CompliancesClientImpl(this); + this.informationProtectionPolicies = new InformationProtectionPoliciesClientImpl(this); + this.securityContacts = new SecurityContactsClientImpl(this); + this.workspaceSettings = new WorkspaceSettingsClientImpl(this); + this.regulatoryComplianceStandards = new RegulatoryComplianceStandardsClientImpl(this); + this.regulatoryComplianceControls = new RegulatoryComplianceControlsClientImpl(this); + this.regulatoryComplianceAssessments = new RegulatoryComplianceAssessmentsClientImpl(this); + this.subAssessments = new SubAssessmentsClientImpl(this); + this.automations = new AutomationsClientImpl(this); + this.alertsSuppressionRules = new AlertsSuppressionRulesClientImpl(this); + this.serverVulnerabilityAssessments = new ServerVulnerabilityAssessmentsClientImpl(this); + this.assessmentsMetadatas = new AssessmentsMetadatasClientImpl(this); + this.assessments = new AssessmentsClientImpl(this); + this.adaptiveApplicationControls = new AdaptiveApplicationControlsClientImpl(this); + this.adaptiveNetworkHardenings = new AdaptiveNetworkHardeningsClientImpl(this); + this.allowedConnections = new AllowedConnectionsClientImpl(this); + this.topologies = new TopologiesClientImpl(this); + this.jitNetworkAccessPolicies = new JitNetworkAccessPoliciesClientImpl(this); + this.discoveredSecuritySolutions = new DiscoveredSecuritySolutionsClientImpl(this); + this.securitySolutionsReferenceDatas = new SecuritySolutionsReferenceDatasClientImpl(this); + this.externalSecuritySolutions = new ExternalSecuritySolutionsClientImpl(this); + this.secureScores = new SecureScoresClientImpl(this); + this.secureScoreControls = new SecureScoreControlsClientImpl(this); + this.secureScoreControlDefinitions = new SecureScoreControlDefinitionsClientImpl(this); + this.securitySolutions = new SecuritySolutionsClientImpl(this); + this.connectors = new ConnectorsClientImpl(this); + this.sqlVulnerabilityAssessmentScans = new SqlVulnerabilityAssessmentScansClientImpl(this); + this.sqlVulnerabilityAssessmentScanResults = new SqlVulnerabilityAssessmentScanResultsClientImpl(this); + this.sqlVulnerabilityAssessmentBaselineRules = new SqlVulnerabilityAssessmentBaselineRulesClientImpl(this); + this.iotDefenderSettings = new IotDefenderSettingsClientImpl(this); + this.iotSensors = new IotSensorsClientImpl(this); + this.devicesForSubscriptions = new DevicesForSubscriptionsClientImpl(this); + this.devicesForHubs = new DevicesForHubsClientImpl(this); + this.devices = new DevicesClientImpl(this); + this.onPremiseIotSensors = new OnPremiseIotSensorsClientImpl(this); + this.iotSites = new IotSitesClientImpl(this); + this.iotAlerts = new IotAlertsClientImpl(this); + this.iotAlertTypes = new IotAlertTypesClientImpl(this); + this.iotRecommendations = new IotRecommendationsClientImpl(this); + this.iotRecommendationTypes = new IotRecommendationTypesClientImpl(this); + this.alerts = new AlertsClientImpl(this); + this.settings = new SettingsClientImpl(this); + this.ingestionSettings = new IngestionSettingsClientImpl(this); + this.softwareInventories = new SoftwareInventoriesClientImpl(this); + } + + /** + * Gets default client context. + * + * @return the default client context. + */ + public Context getContext() { + return Context.NONE; + } + + /** + * Merges default client context with provided context. + * + * @param context the context to be merged with default client context. + * @return the merged context. + */ + public Context mergeContext(Context context) { + for (Map.Entry entry : this.getContext().getValues().entrySet()) { + context = context.addData(entry.getKey(), entry.getValue()); + } + return context; + } + + /** + * Gets long running operation result. + * + * @param activationResponse the response of activation operation. + * @param httpPipeline the http pipeline. + * @param pollResultType type of poll result. + * @param finalResultType type of final result. + * @param context the context shared by all requests. + * @param type of poll result. + * @param type of final result. + * @return poller flux for poll result and final result. + */ + public PollerFlux, U> getLroResult( + Mono>> activationResponse, + HttpPipeline httpPipeline, + Type pollResultType, + Type finalResultType, + Context context) { + return PollerFactory + .create( + serializerAdapter, + httpPipeline, + pollResultType, + finalResultType, + defaultPollInterval, + activationResponse, + context); + } + + /** + * Gets the final result, or an error, based on last async poll response. + * + * @param response the last async poll response. + * @param type of poll result. + * @param type of final result. + * @return the final result, or an error. + */ + public Mono getLroFinalResultOrError(AsyncPollResponse, U> response) { + if (response.getStatus() != LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) { + String errorMessage; + ManagementError managementError = null; + HttpResponse errorResponse = null; + PollResult.Error lroError = response.getValue().getError(); + if (lroError != null) { + errorResponse = + new HttpResponseImpl( + lroError.getResponseStatusCode(), lroError.getResponseHeaders(), lroError.getResponseBody()); + + errorMessage = response.getValue().getError().getMessage(); + String errorBody = response.getValue().getError().getResponseBody(); + if (errorBody != null) { + // try to deserialize error body to ManagementError + try { + managementError = + this + .getSerializerAdapter() + .deserialize(errorBody, ManagementError.class, SerializerEncoding.JSON); + if (managementError.getCode() == null || managementError.getMessage() == null) { + managementError = null; + } + } catch (IOException | RuntimeException ioe) { + logger.logThrowableAsWarning(ioe); + } + } + } else { + // fallback to default error message + errorMessage = "Long running operation failed."; + } + if (managementError == null) { + // fallback to default ManagementError + managementError = new ManagementError(response.getStatus().toString(), errorMessage); + } + return Mono.error(new ManagementException(errorMessage, errorResponse, managementError)); + } else { + return response.getFinalResult(); + } + } + + private static final class HttpResponseImpl extends HttpResponse { + private final int statusCode; + + private final byte[] responseBody; + + private final HttpHeaders httpHeaders; + + HttpResponseImpl(int statusCode, HttpHeaders httpHeaders, String responseBody) { + super(null); + this.statusCode = statusCode; + this.httpHeaders = httpHeaders; + this.responseBody = responseBody == null ? null : responseBody.getBytes(StandardCharsets.UTF_8); + } + + public int getStatusCode() { + return statusCode; + } + + public String getHeaderValue(String s) { + return httpHeaders.getValue(s); + } + + public HttpHeaders getHeaders() { + return httpHeaders; + } + + public Flux getBody() { + return Flux.just(ByteBuffer.wrap(responseBody)); + } + + public Mono getBodyAsByteArray() { + return Mono.just(responseBody); + } + + public Mono getBodyAsString() { + return Mono.just(new String(responseBody, StandardCharsets.UTF_8)); + } + + public Mono getBodyAsString(Charset charset) { + return Mono.just(new String(responseBody, charset)); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecurityContactImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecurityContactImpl.java new file mode 100644 index 000000000000..ee717dbdb6c4 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecurityContactImpl.java @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.SecurityContactInner; +import com.azure.resourcemanager.security.models.AlertNotifications; +import com.azure.resourcemanager.security.models.AlertsToAdmins; +import com.azure.resourcemanager.security.models.SecurityContact; + +public final class SecurityContactImpl implements SecurityContact, SecurityContact.Definition, SecurityContact.Update { + private SecurityContactInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String email() { + return this.innerModel().email(); + } + + public String phone() { + return this.innerModel().phone(); + } + + public AlertNotifications alertNotifications() { + return this.innerModel().alertNotifications(); + } + + public AlertsToAdmins alertsToAdmins() { + return this.innerModel().alertsToAdmins(); + } + + public SecurityContactInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } + + private String securityContactName; + + public SecurityContact create() { + this.innerObject = + serviceManager + .serviceClient() + .getSecurityContacts() + .createWithResponse(securityContactName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public SecurityContact create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSecurityContacts() + .createWithResponse(securityContactName, this.innerModel(), context) + .getValue(); + return this; + } + + SecurityContactImpl(String name, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = new SecurityContactInner(); + this.serviceManager = serviceManager; + this.securityContactName = name; + } + + public SecurityContactImpl update() { + return this; + } + + public SecurityContact apply() { + this.innerObject = + serviceManager + .serviceClient() + .getSecurityContacts() + .updateWithResponse(securityContactName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public SecurityContact apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSecurityContacts() + .updateWithResponse(securityContactName, this.innerModel(), context) + .getValue(); + return this; + } + + SecurityContactImpl( + SecurityContactInner innerObject, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.securityContactName = Utils.getValueFromIdByName(innerObject.id(), "securityContacts"); + } + + public SecurityContact refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getSecurityContacts() + .getWithResponse(securityContactName, Context.NONE) + .getValue(); + return this; + } + + public SecurityContact refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSecurityContacts() + .getWithResponse(securityContactName, context) + .getValue(); + return this; + } + + public SecurityContactImpl withEmail(String email) { + this.innerModel().withEmail(email); + return this; + } + + public SecurityContactImpl withPhone(String phone) { + this.innerModel().withPhone(phone); + return this; + } + + public SecurityContactImpl withAlertNotifications(AlertNotifications alertNotifications) { + this.innerModel().withAlertNotifications(alertNotifications); + return this; + } + + public SecurityContactImpl withAlertsToAdmins(AlertsToAdmins alertsToAdmins) { + this.innerModel().withAlertsToAdmins(alertsToAdmins); + return this; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecurityContactsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecurityContactsClientImpl.java new file mode 100644 index 000000000000..cc0a890b06ba --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecurityContactsClientImpl.java @@ -0,0 +1,915 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.SecurityContactsClient; +import com.azure.resourcemanager.security.fluent.models.SecurityContactInner; +import com.azure.resourcemanager.security.models.SecurityContactList; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in SecurityContactsClient. */ +public final class SecurityContactsClientImpl implements SecurityContactsClient { + private final ClientLogger logger = new ClientLogger(SecurityContactsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final SecurityContactsService service; + + /** The service client containing this operation class. */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of SecurityContactsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SecurityContactsClientImpl(SecurityCenterImpl client) { + this.service = + RestProxy.create(SecurityContactsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterSecurityContacts to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityCenterSecuri") + private interface SecurityContactsService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/securityContacts") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/securityContacts/{securityContactName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("securityContactName") String securityContactName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put("/subscriptions/{subscriptionId}/providers/Microsoft.Security/securityContacts/{securityContactName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> create( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("securityContactName") String securityContactName, + @BodyParam("application/json") SecurityContactInner securityContact, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete("/subscriptions/{subscriptionId}/providers/Microsoft.Security/securityContacts/{securityContactName}") + @ExpectedResponses({204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("securityContactName") String securityContactName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch("/subscriptions/{subscriptionId}/providers/Microsoft.Security/securityContacts/{securityContactName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("securityContactName") String securityContactName, + @BodyParam("application/json") SecurityContactInner securityContact, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Security contact configurations for the subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security contacts response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-08-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Security contact configurations for the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security contacts response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-08-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Security contact configurations for the subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security contacts response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Security contact configurations for the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security contacts response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Security contact configurations for the subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security contacts response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Security contact configurations for the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security contacts response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Security contact configurations for the subscription. + * + * @param securityContactName Name of the security contact object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return contact details for security issues. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String securityContactName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (securityContactName == null) { + return Mono + .error(new IllegalArgumentException("Parameter securityContactName is required and cannot be null.")); + } + final String apiVersion = "2017-08-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + securityContactName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Security contact configurations for the subscription. + * + * @param securityContactName Name of the security contact object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return contact details for security issues. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String securityContactName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (securityContactName == null) { + return Mono + .error(new IllegalArgumentException("Parameter securityContactName is required and cannot be null.")); + } + final String apiVersion = "2017-08-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + securityContactName, + accept, + context); + } + + /** + * Security contact configurations for the subscription. + * + * @param securityContactName Name of the security contact object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return contact details for security issues. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String securityContactName) { + return getWithResponseAsync(securityContactName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Security contact configurations for the subscription. + * + * @param securityContactName Name of the security contact object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return contact details for security issues. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SecurityContactInner get(String securityContactName) { + return getAsync(securityContactName).block(); + } + + /** + * Security contact configurations for the subscription. + * + * @param securityContactName Name of the security contact object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return contact details for security issues. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String securityContactName, Context context) { + return getWithResponseAsync(securityContactName, context).block(); + } + + /** + * Security contact configurations for the subscription. + * + * @param securityContactName Name of the security contact object. + * @param securityContact Security contact object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return contact details for security issues. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync( + String securityContactName, SecurityContactInner securityContact) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (securityContactName == null) { + return Mono + .error(new IllegalArgumentException("Parameter securityContactName is required and cannot be null.")); + } + if (securityContact == null) { + return Mono + .error(new IllegalArgumentException("Parameter securityContact is required and cannot be null.")); + } else { + securityContact.validate(); + } + final String apiVersion = "2017-08-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .create( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + securityContactName, + securityContact, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Security contact configurations for the subscription. + * + * @param securityContactName Name of the security contact object. + * @param securityContact Security contact object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return contact details for security issues. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync( + String securityContactName, SecurityContactInner securityContact, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (securityContactName == null) { + return Mono + .error(new IllegalArgumentException("Parameter securityContactName is required and cannot be null.")); + } + if (securityContact == null) { + return Mono + .error(new IllegalArgumentException("Parameter securityContact is required and cannot be null.")); + } else { + securityContact.validate(); + } + final String apiVersion = "2017-08-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .create( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + securityContactName, + securityContact, + accept, + context); + } + + /** + * Security contact configurations for the subscription. + * + * @param securityContactName Name of the security contact object. + * @param securityContact Security contact object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return contact details for security issues. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync(String securityContactName, SecurityContactInner securityContact) { + return createWithResponseAsync(securityContactName, securityContact) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Security contact configurations for the subscription. + * + * @param securityContactName Name of the security contact object. + * @param securityContact Security contact object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return contact details for security issues. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SecurityContactInner create(String securityContactName, SecurityContactInner securityContact) { + return createAsync(securityContactName, securityContact).block(); + } + + /** + * Security contact configurations for the subscription. + * + * @param securityContactName Name of the security contact object. + * @param securityContact Security contact object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return contact details for security issues. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createWithResponse( + String securityContactName, SecurityContactInner securityContact, Context context) { + return createWithResponseAsync(securityContactName, securityContact, context).block(); + } + + /** + * Security contact configurations for the subscription. + * + * @param securityContactName Name of the security contact object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String securityContactName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (securityContactName == null) { + return Mono + .error(new IllegalArgumentException("Parameter securityContactName is required and cannot be null.")); + } + final String apiVersion = "2017-08-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + securityContactName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Security contact configurations for the subscription. + * + * @param securityContactName Name of the security contact object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String securityContactName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (securityContactName == null) { + return Mono + .error(new IllegalArgumentException("Parameter securityContactName is required and cannot be null.")); + } + final String apiVersion = "2017-08-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + securityContactName, + accept, + context); + } + + /** + * Security contact configurations for the subscription. + * + * @param securityContactName Name of the security contact object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String securityContactName) { + return deleteWithResponseAsync(securityContactName).flatMap((Response res) -> Mono.empty()); + } + + /** + * Security contact configurations for the subscription. + * + * @param securityContactName Name of the security contact object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String securityContactName) { + deleteAsync(securityContactName).block(); + } + + /** + * Security contact configurations for the subscription. + * + * @param securityContactName Name of the security contact object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String securityContactName, Context context) { + return deleteWithResponseAsync(securityContactName, context).block(); + } + + /** + * Security contact configurations for the subscription. + * + * @param securityContactName Name of the security contact object. + * @param securityContact Security contact object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return contact details for security issues. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String securityContactName, SecurityContactInner securityContact) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (securityContactName == null) { + return Mono + .error(new IllegalArgumentException("Parameter securityContactName is required and cannot be null.")); + } + if (securityContact == null) { + return Mono + .error(new IllegalArgumentException("Parameter securityContact is required and cannot be null.")); + } else { + securityContact.validate(); + } + final String apiVersion = "2017-08-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + securityContactName, + securityContact, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Security contact configurations for the subscription. + * + * @param securityContactName Name of the security contact object. + * @param securityContact Security contact object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return contact details for security issues. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String securityContactName, SecurityContactInner securityContact, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (securityContactName == null) { + return Mono + .error(new IllegalArgumentException("Parameter securityContactName is required and cannot be null.")); + } + if (securityContact == null) { + return Mono + .error(new IllegalArgumentException("Parameter securityContact is required and cannot be null.")); + } else { + securityContact.validate(); + } + final String apiVersion = "2017-08-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + securityContactName, + securityContact, + accept, + context); + } + + /** + * Security contact configurations for the subscription. + * + * @param securityContactName Name of the security contact object. + * @param securityContact Security contact object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return contact details for security issues. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String securityContactName, SecurityContactInner securityContact) { + return updateWithResponseAsync(securityContactName, securityContact) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Security contact configurations for the subscription. + * + * @param securityContactName Name of the security contact object. + * @param securityContact Security contact object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return contact details for security issues. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SecurityContactInner update(String securityContactName, SecurityContactInner securityContact) { + return updateAsync(securityContactName, securityContact).block(); + } + + /** + * Security contact configurations for the subscription. + * + * @param securityContactName Name of the security contact object. + * @param securityContact Security contact object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return contact details for security issues. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String securityContactName, SecurityContactInner securityContact, Context context) { + return updateWithResponseAsync(securityContactName, securityContact, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security contacts response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security contacts response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecurityContactsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecurityContactsImpl.java new file mode 100644 index 000000000000..38d44220628b --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecurityContactsImpl.java @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.SecurityContactsClient; +import com.azure.resourcemanager.security.fluent.models.SecurityContactInner; +import com.azure.resourcemanager.security.models.SecurityContact; +import com.azure.resourcemanager.security.models.SecurityContacts; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class SecurityContactsImpl implements SecurityContacts { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SecurityContactsImpl.class); + + private final SecurityContactsClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public SecurityContactsImpl( + SecurityContactsClient innerClient, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new SecurityContactImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new SecurityContactImpl(inner1, this.manager())); + } + + public SecurityContact get(String securityContactName) { + SecurityContactInner inner = this.serviceClient().get(securityContactName); + if (inner != null) { + return new SecurityContactImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse(String securityContactName, Context context) { + Response inner = this.serviceClient().getWithResponse(securityContactName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new SecurityContactImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String securityContactName) { + this.serviceClient().delete(securityContactName); + } + + public Response deleteWithResponse(String securityContactName, Context context) { + return this.serviceClient().deleteWithResponse(securityContactName, context); + } + + public SecurityContact getById(String id) { + String securityContactName = Utils.getValueFromIdByName(id, "securityContacts"); + if (securityContactName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'securityContacts'.", id))); + } + return this.getWithResponse(securityContactName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String securityContactName = Utils.getValueFromIdByName(id, "securityContacts"); + if (securityContactName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'securityContacts'.", id))); + } + return this.getWithResponse(securityContactName, context); + } + + public void deleteById(String id) { + String securityContactName = Utils.getValueFromIdByName(id, "securityContacts"); + if (securityContactName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'securityContacts'.", id))); + } + this.deleteWithResponse(securityContactName, Context.NONE).getValue(); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String securityContactName = Utils.getValueFromIdByName(id, "securityContacts"); + if (securityContactName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'securityContacts'.", id))); + } + return this.deleteWithResponse(securityContactName, context); + } + + private SecurityContactsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } + + public SecurityContactImpl define(String name) { + return new SecurityContactImpl(name, this.manager()); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecuritySolutionImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecuritySolutionImpl.java new file mode 100644 index 000000000000..2104e64221a2 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecuritySolutionImpl.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.resourcemanager.security.fluent.models.SecuritySolutionInner; +import com.azure.resourcemanager.security.models.ProvisioningState; +import com.azure.resourcemanager.security.models.SecurityFamily; +import com.azure.resourcemanager.security.models.SecuritySolution; + +public final class SecuritySolutionImpl implements SecuritySolution { + private SecuritySolutionInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + SecuritySolutionImpl( + SecuritySolutionInner innerObject, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public SecurityFamily securityFamily() { + return this.innerModel().securityFamily(); + } + + public ProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public String template() { + return this.innerModel().template(); + } + + public String protectionStatus() { + return this.innerModel().protectionStatus(); + } + + public String location() { + return this.innerModel().location(); + } + + public SecuritySolutionInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecuritySolutionsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecuritySolutionsClientImpl.java new file mode 100644 index 000000000000..dfa1de8c4f41 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecuritySolutionsClientImpl.java @@ -0,0 +1,479 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.SecuritySolutionsClient; +import com.azure.resourcemanager.security.fluent.models.SecuritySolutionInner; +import com.azure.resourcemanager.security.models.SecuritySolutionList; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in SecuritySolutionsClient. */ +public final class SecuritySolutionsClientImpl implements SecuritySolutionsClient { + private final ClientLogger logger = new ClientLogger(SecuritySolutionsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final SecuritySolutionsService service; + + /** The service client containing this operation class. */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of SecuritySolutionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SecuritySolutionsClientImpl(SecurityCenterImpl client) { + this.service = + RestProxy.create(SecuritySolutionsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterSecuritySolutions to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityCenterSecuri") + private interface SecuritySolutionsService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/securitySolutions") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations" + + "/{ascLocation}/securitySolutions/{securitySolutionName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("ascLocation") String ascLocation, + @PathParam("securitySolutionName") String securitySolutionName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a list of Security Solutions for the subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Security Solutions for the subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list(this.client.getEndpoint(), this.client.getSubscriptionId(), apiVersion, accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of Security Solutions for the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Security Solutions for the subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getSubscriptionId(), apiVersion, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a list of Security Solutions for the subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Security Solutions for the subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of Security Solutions for the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Security Solutions for the subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list of Security Solutions for the subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Security Solutions for the subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Gets a list of Security Solutions for the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Security Solutions for the subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Gets a specific Security Solution. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param securitySolutionName Name of security solution. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a specific Security Solution. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String ascLocation, String securitySolutionName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (ascLocation == null) { + return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + if (securitySolutionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter securitySolutionName is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + ascLocation, + securitySolutionName, + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a specific Security Solution. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param securitySolutionName Name of security solution. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a specific Security Solution. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String ascLocation, String securitySolutionName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (ascLocation == null) { + return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + if (securitySolutionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter securitySolutionName is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + ascLocation, + securitySolutionName, + apiVersion, + accept, + context); + } + + /** + * Gets a specific Security Solution. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param securitySolutionName Name of security solution. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a specific Security Solution. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String ascLocation, String securitySolutionName) { + return getWithResponseAsync(resourceGroupName, ascLocation, securitySolutionName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a specific Security Solution. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param securitySolutionName Name of security solution. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a specific Security Solution. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SecuritySolutionInner get(String resourceGroupName, String ascLocation, String securitySolutionName) { + return getAsync(resourceGroupName, ascLocation, securitySolutionName).block(); + } + + /** + * Gets a specific Security Solution. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param securitySolutionName Name of security solution. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a specific Security Solution. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String ascLocation, String securitySolutionName, Context context) { + return getWithResponseAsync(resourceGroupName, ascLocation, securitySolutionName, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecuritySolutionsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecuritySolutionsImpl.java new file mode 100644 index 000000000000..25b63091c4c5 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecuritySolutionsImpl.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.SecuritySolutionsClient; +import com.azure.resourcemanager.security.fluent.models.SecuritySolutionInner; +import com.azure.resourcemanager.security.models.SecuritySolution; +import com.azure.resourcemanager.security.models.SecuritySolutions; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class SecuritySolutionsImpl implements SecuritySolutions { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SecuritySolutionsImpl.class); + + private final SecuritySolutionsClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public SecuritySolutionsImpl( + SecuritySolutionsClient innerClient, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new SecuritySolutionImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new SecuritySolutionImpl(inner1, this.manager())); + } + + public SecuritySolution get(String resourceGroupName, String ascLocation, String securitySolutionName) { + SecuritySolutionInner inner = this.serviceClient().get(resourceGroupName, ascLocation, securitySolutionName); + if (inner != null) { + return new SecuritySolutionImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String ascLocation, String securitySolutionName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, ascLocation, securitySolutionName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new SecuritySolutionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private SecuritySolutionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecuritySolutionsReferenceDataListImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecuritySolutionsReferenceDataListImpl.java new file mode 100644 index 000000000000..0e961ffe1342 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecuritySolutionsReferenceDataListImpl.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.resourcemanager.security.fluent.models.SecuritySolutionsReferenceDataListInner; +import com.azure.resourcemanager.security.models.SecuritySolutionsReferenceData; +import com.azure.resourcemanager.security.models.SecuritySolutionsReferenceDataList; +import java.util.Collections; +import java.util.List; + +public final class SecuritySolutionsReferenceDataListImpl implements SecuritySolutionsReferenceDataList { + private SecuritySolutionsReferenceDataListInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + SecuritySolutionsReferenceDataListImpl( + SecuritySolutionsReferenceDataListInner innerObject, + com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public List value() { + List inner = this.innerModel().value(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public SecuritySolutionsReferenceDataListInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecuritySolutionsReferenceDatasClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecuritySolutionsReferenceDatasClientImpl.java new file mode 100644 index 000000000000..a649a1118b8e --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecuritySolutionsReferenceDatasClientImpl.java @@ -0,0 +1,328 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.SecuritySolutionsReferenceDatasClient; +import com.azure.resourcemanager.security.fluent.models.SecuritySolutionsReferenceDataListInner; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in SecuritySolutionsReferenceDatasClient. */ +public final class SecuritySolutionsReferenceDatasClientImpl implements SecuritySolutionsReferenceDatasClient { + private final ClientLogger logger = new ClientLogger(SecuritySolutionsReferenceDatasClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final SecuritySolutionsReferenceDatasService service; + + /** The service client containing this operation class. */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of SecuritySolutionsReferenceDatasClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SecuritySolutionsReferenceDatasClientImpl(SecurityCenterImpl client) { + this.service = + RestProxy + .create( + SecuritySolutionsReferenceDatasService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterSecuritySolutionsReferenceDatas to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityCenterSecuri") + private interface SecuritySolutionsReferenceDatasService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/securitySolutionsReferenceData") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}" + + "/securitySolutionsReferenceData") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByHomeRegion( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("ascLocation") String ascLocation, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a list of all supported Security Solutions for the subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all supported Security Solutions for the subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listWithResponseAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list(this.client.getEndpoint(), this.client.getSubscriptionId(), apiVersion, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of all supported Security Solutions for the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all supported Security Solutions for the subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listWithResponseAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.list(this.client.getEndpoint(), this.client.getSubscriptionId(), apiVersion, accept, context); + } + + /** + * Gets a list of all supported Security Solutions for the subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all supported Security Solutions for the subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listAsync() { + return listWithResponseAsync() + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a list of all supported Security Solutions for the subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all supported Security Solutions for the subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SecuritySolutionsReferenceDataListInner list() { + return listAsync().block(); + } + + /** + * Gets a list of all supported Security Solutions for the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all supported Security Solutions for the subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listWithResponse(Context context) { + return listWithResponseAsync(context).block(); + } + + /** + * Gets list of all supported Security Solutions for subscription and location. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of all supported Security Solutions for subscription and location. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByHomeRegionWithResponseAsync( + String ascLocation) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (ascLocation == null) { + return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByHomeRegion( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + ascLocation, + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets list of all supported Security Solutions for subscription and location. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of all supported Security Solutions for subscription and location. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByHomeRegionWithResponseAsync( + String ascLocation, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (ascLocation == null) { + return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByHomeRegion( + this.client.getEndpoint(), this.client.getSubscriptionId(), ascLocation, apiVersion, accept, context); + } + + /** + * Gets list of all supported Security Solutions for subscription and location. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of all supported Security Solutions for subscription and location. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listByHomeRegionAsync(String ascLocation) { + return listByHomeRegionWithResponseAsync(ascLocation) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets list of all supported Security Solutions for subscription and location. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of all supported Security Solutions for subscription and location. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SecuritySolutionsReferenceDataListInner listByHomeRegion(String ascLocation) { + return listByHomeRegionAsync(ascLocation).block(); + } + + /** + * Gets list of all supported Security Solutions for subscription and location. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of all supported Security Solutions for subscription and location. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listByHomeRegionWithResponse( + String ascLocation, Context context) { + return listByHomeRegionWithResponseAsync(ascLocation, context).block(); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecuritySolutionsReferenceDatasImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecuritySolutionsReferenceDatasImpl.java new file mode 100644 index 000000000000..68c3965f274b --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecuritySolutionsReferenceDatasImpl.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.SecuritySolutionsReferenceDatasClient; +import com.azure.resourcemanager.security.fluent.models.SecuritySolutionsReferenceDataListInner; +import com.azure.resourcemanager.security.models.SecuritySolutionsReferenceDataList; +import com.azure.resourcemanager.security.models.SecuritySolutionsReferenceDatas; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class SecuritySolutionsReferenceDatasImpl implements SecuritySolutionsReferenceDatas { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SecuritySolutionsReferenceDatasImpl.class); + + private final SecuritySolutionsReferenceDatasClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public SecuritySolutionsReferenceDatasImpl( + SecuritySolutionsReferenceDatasClient innerClient, + com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public SecuritySolutionsReferenceDataList list() { + SecuritySolutionsReferenceDataListInner inner = this.serviceClient().list(); + if (inner != null) { + return new SecuritySolutionsReferenceDataListImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response listWithResponse(Context context) { + Response inner = this.serviceClient().listWithResponse(context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new SecuritySolutionsReferenceDataListImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public SecuritySolutionsReferenceDataList listByHomeRegion(String ascLocation) { + SecuritySolutionsReferenceDataListInner inner = this.serviceClient().listByHomeRegion(ascLocation); + if (inner != null) { + return new SecuritySolutionsReferenceDataListImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response listByHomeRegionWithResponse( + String ascLocation, Context context) { + Response inner = + this.serviceClient().listByHomeRegionWithResponse(ascLocation, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new SecuritySolutionsReferenceDataListImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private SecuritySolutionsReferenceDatasClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecuritySubAssessmentImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecuritySubAssessmentImpl.java new file mode 100644 index 000000000000..3fb497b072b7 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecuritySubAssessmentImpl.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.resourcemanager.security.fluent.models.SecuritySubAssessmentInner; +import com.azure.resourcemanager.security.models.AdditionalData; +import com.azure.resourcemanager.security.models.ResourceDetails; +import com.azure.resourcemanager.security.models.SecuritySubAssessment; +import com.azure.resourcemanager.security.models.SubAssessmentStatus; +import java.time.OffsetDateTime; + +public final class SecuritySubAssessmentImpl implements SecuritySubAssessment { + private SecuritySubAssessmentInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + SecuritySubAssessmentImpl( + SecuritySubAssessmentInner innerObject, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String idPropertiesId() { + return this.innerModel().idPropertiesId(); + } + + public String displayName() { + return this.innerModel().displayName(); + } + + public SubAssessmentStatus status() { + return this.innerModel().status(); + } + + public String remediation() { + return this.innerModel().remediation(); + } + + public String impact() { + return this.innerModel().impact(); + } + + public String category() { + return this.innerModel().category(); + } + + public String description() { + return this.innerModel().description(); + } + + public OffsetDateTime timeGenerated() { + return this.innerModel().timeGenerated(); + } + + public ResourceDetails resourceDetails() { + return this.innerModel().resourceDetails(); + } + + public AdditionalData additionalData() { + return this.innerModel().additionalData(); + } + + public SecuritySubAssessmentInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecurityTaskImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecurityTaskImpl.java new file mode 100644 index 000000000000..6d71c09739a1 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecurityTaskImpl.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.resourcemanager.security.fluent.models.SecurityTaskInner; +import com.azure.resourcemanager.security.models.SecurityTask; +import com.azure.resourcemanager.security.models.SecurityTaskParameters; +import java.time.OffsetDateTime; + +public final class SecurityTaskImpl implements SecurityTask { + private SecurityTaskInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + SecurityTaskImpl(SecurityTaskInner innerObject, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String state() { + return this.innerModel().state(); + } + + public OffsetDateTime creationTimeUtc() { + return this.innerModel().creationTimeUtc(); + } + + public SecurityTaskParameters securityTaskParameters() { + return this.innerModel().securityTaskParameters(); + } + + public OffsetDateTime lastStateChangeTimeUtc() { + return this.innerModel().lastStateChangeTimeUtc(); + } + + public String subState() { + return this.innerModel().subState(); + } + + public SecurityTaskInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ServerVulnerabilityAssessmentImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ServerVulnerabilityAssessmentImpl.java new file mode 100644 index 000000000000..f12420391d62 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ServerVulnerabilityAssessmentImpl.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.resourcemanager.security.fluent.models.ServerVulnerabilityAssessmentInner; +import com.azure.resourcemanager.security.models.ServerVulnerabilityAssessment; +import com.azure.resourcemanager.security.models.ServerVulnerabilityAssessmentPropertiesProvisioningState; + +public final class ServerVulnerabilityAssessmentImpl implements ServerVulnerabilityAssessment { + private ServerVulnerabilityAssessmentInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + ServerVulnerabilityAssessmentImpl( + ServerVulnerabilityAssessmentInner innerObject, + com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public ServerVulnerabilityAssessmentPropertiesProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public ServerVulnerabilityAssessmentInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ServerVulnerabilityAssessmentsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ServerVulnerabilityAssessmentsClientImpl.java new file mode 100644 index 000000000000..6cd6ba6e4123 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ServerVulnerabilityAssessmentsClientImpl.java @@ -0,0 +1,1009 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.security.fluent.ServerVulnerabilityAssessmentsClient; +import com.azure.resourcemanager.security.fluent.models.ServerVulnerabilityAssessmentInner; +import com.azure.resourcemanager.security.fluent.models.ServerVulnerabilityAssessmentsListInner; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ServerVulnerabilityAssessmentsClient. */ +public final class ServerVulnerabilityAssessmentsClientImpl implements ServerVulnerabilityAssessmentsClient { + private final ClientLogger logger = new ClientLogger(ServerVulnerabilityAssessmentsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ServerVulnerabilityAssessmentsService service; + + /** The service client containing this operation class. */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of ServerVulnerabilityAssessmentsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ServerVulnerabilityAssessmentsClientImpl(SecurityCenterImpl client) { + this.service = + RestProxy + .create( + ServerVulnerabilityAssessmentsService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterServerVulnerabilityAssessments to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityCenterServer") + private interface ServerVulnerabilityAssessmentsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}" + + "/{resourceType}/{resourceName}/providers/Microsoft.Security/serverVulnerabilityAssessments") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByExtendedResource( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("resourceNamespace") String resourceNamespace, + @PathParam("resourceType") String resourceType, + @PathParam("resourceName") String resourceName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}" + + "/{resourceType}/{resourceName}/providers/Microsoft.Security/serverVulnerabilityAssessments" + + "/{serverVulnerabilityAssessment}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("resourceNamespace") String resourceNamespace, + @PathParam("resourceType") String resourceType, + @PathParam("resourceName") String resourceName, + @PathParam("serverVulnerabilityAssessment") String serverVulnerabilityAssessment, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}" + + "/{resourceType}/{resourceName}/providers/Microsoft.Security/serverVulnerabilityAssessments" + + "/{serverVulnerabilityAssessment}") + @ExpectedResponses({202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("resourceNamespace") String resourceNamespace, + @PathParam("resourceType") String resourceType, + @PathParam("resourceName") String resourceName, + @PathParam("serverVulnerabilityAssessment") String serverVulnerabilityAssessment, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}" + + "/{resourceType}/{resourceName}/providers/Microsoft.Security/serverVulnerabilityAssessments" + + "/{serverVulnerabilityAssessment}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("resourceNamespace") String resourceNamespace, + @PathParam("resourceType") String resourceType, + @PathParam("resourceName") String resourceName, + @PathParam("serverVulnerabilityAssessment") String serverVulnerabilityAssessment, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a list of server vulnerability assessment onboarding statuses on a given resource. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server vulnerability assessment onboarding statuses on a given resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByExtendedResourceWithResponseAsync( + String resourceGroupName, String resourceNamespace, String resourceType, String resourceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourceNamespace == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceNamespace is required and cannot be null.")); + } + if (resourceType == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceType is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByExtendedResource( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceNamespace, + resourceType, + resourceName, + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of server vulnerability assessment onboarding statuses on a given resource. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server vulnerability assessment onboarding statuses on a given resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByExtendedResourceWithResponseAsync( + String resourceGroupName, String resourceNamespace, String resourceType, String resourceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourceNamespace == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceNamespace is required and cannot be null.")); + } + if (resourceType == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceType is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByExtendedResource( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceNamespace, + resourceType, + resourceName, + apiVersion, + accept, + context); + } + + /** + * Gets a list of server vulnerability assessment onboarding statuses on a given resource. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server vulnerability assessment onboarding statuses on a given resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listByExtendedResourceAsync( + String resourceGroupName, String resourceNamespace, String resourceType, String resourceName) { + return listByExtendedResourceWithResponseAsync(resourceGroupName, resourceNamespace, resourceType, resourceName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a list of server vulnerability assessment onboarding statuses on a given resource. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server vulnerability assessment onboarding statuses on a given resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerVulnerabilityAssessmentsListInner listByExtendedResource( + String resourceGroupName, String resourceNamespace, String resourceType, String resourceName) { + return listByExtendedResourceAsync(resourceGroupName, resourceNamespace, resourceType, resourceName).block(); + } + + /** + * Gets a list of server vulnerability assessment onboarding statuses on a given resource. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server vulnerability assessment onboarding statuses on a given resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listByExtendedResourceWithResponse( + String resourceGroupName, String resourceNamespace, String resourceType, String resourceName, Context context) { + return listByExtendedResourceWithResponseAsync( + resourceGroupName, resourceNamespace, resourceType, resourceName, context) + .block(); + } + + /** + * Gets a server vulnerability assessment onboarding statuses on a given resource. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server vulnerability assessment onboarding statuses on a given resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String resourceNamespace, String resourceType, String resourceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourceNamespace == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceNamespace is required and cannot be null.")); + } + if (resourceType == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceType is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + final String serverVulnerabilityAssessment = "default"; + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceNamespace, + resourceType, + resourceName, + serverVulnerabilityAssessment, + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a server vulnerability assessment onboarding statuses on a given resource. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server vulnerability assessment onboarding statuses on a given resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String resourceNamespace, String resourceType, String resourceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourceNamespace == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceNamespace is required and cannot be null.")); + } + if (resourceType == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceType is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + final String serverVulnerabilityAssessment = "default"; + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceNamespace, + resourceType, + resourceName, + serverVulnerabilityAssessment, + apiVersion, + accept, + context); + } + + /** + * Gets a server vulnerability assessment onboarding statuses on a given resource. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server vulnerability assessment onboarding statuses on a given resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String resourceNamespace, String resourceType, String resourceName) { + return getWithResponseAsync(resourceGroupName, resourceNamespace, resourceType, resourceName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a server vulnerability assessment onboarding statuses on a given resource. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server vulnerability assessment onboarding statuses on a given resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerVulnerabilityAssessmentInner get( + String resourceGroupName, String resourceNamespace, String resourceType, String resourceName) { + return getAsync(resourceGroupName, resourceNamespace, resourceType, resourceName).block(); + } + + /** + * Gets a server vulnerability assessment onboarding statuses on a given resource. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server vulnerability assessment onboarding statuses on a given resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String resourceNamespace, String resourceType, String resourceName, Context context) { + return getWithResponseAsync(resourceGroupName, resourceNamespace, resourceType, resourceName, context).block(); + } + + /** + * Creating a server vulnerability assessment on a resource, which will onboard a resource for having a + * vulnerability assessment on it. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the server vulnerability assessment details on a resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, String resourceNamespace, String resourceType, String resourceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourceNamespace == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceNamespace is required and cannot be null.")); + } + if (resourceType == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceType is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + final String serverVulnerabilityAssessment = "default"; + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceNamespace, + resourceType, + resourceName, + serverVulnerabilityAssessment, + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creating a server vulnerability assessment on a resource, which will onboard a resource for having a + * vulnerability assessment on it. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the server vulnerability assessment details on a resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, String resourceNamespace, String resourceType, String resourceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourceNamespace == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceNamespace is required and cannot be null.")); + } + if (resourceType == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceType is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + final String serverVulnerabilityAssessment = "default"; + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceNamespace, + resourceType, + resourceName, + serverVulnerabilityAssessment, + apiVersion, + accept, + context); + } + + /** + * Creating a server vulnerability assessment on a resource, which will onboard a resource for having a + * vulnerability assessment on it. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the server vulnerability assessment details on a resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String resourceNamespace, String resourceType, String resourceName) { + return createOrUpdateWithResponseAsync(resourceGroupName, resourceNamespace, resourceType, resourceName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Creating a server vulnerability assessment on a resource, which will onboard a resource for having a + * vulnerability assessment on it. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the server vulnerability assessment details on a resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerVulnerabilityAssessmentInner createOrUpdate( + String resourceGroupName, String resourceNamespace, String resourceType, String resourceName) { + return createOrUpdateAsync(resourceGroupName, resourceNamespace, resourceType, resourceName).block(); + } + + /** + * Creating a server vulnerability assessment on a resource, which will onboard a resource for having a + * vulnerability assessment on it. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the server vulnerability assessment details on a resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, String resourceNamespace, String resourceType, String resourceName, Context context) { + return createOrUpdateWithResponseAsync( + resourceGroupName, resourceNamespace, resourceType, resourceName, context) + .block(); + } + + /** + * Removing server vulnerability assessment from a resource. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String resourceNamespace, String resourceType, String resourceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourceNamespace == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceNamespace is required and cannot be null.")); + } + if (resourceType == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceType is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + final String serverVulnerabilityAssessment = "default"; + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceNamespace, + resourceType, + resourceName, + serverVulnerabilityAssessment, + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Removing server vulnerability assessment from a resource. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String resourceNamespace, String resourceType, String resourceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourceNamespace == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceNamespace is required and cannot be null.")); + } + if (resourceType == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceType is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + final String serverVulnerabilityAssessment = "default"; + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceNamespace, + resourceType, + resourceName, + serverVulnerabilityAssessment, + apiVersion, + accept, + context); + } + + /** + * Removing server vulnerability assessment from a resource. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String resourceNamespace, String resourceType, String resourceName) { + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, resourceNamespace, resourceType, resourceName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Removing server vulnerability assessment from a resource. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String resourceNamespace, String resourceType, String resourceName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, resourceNamespace, resourceType, resourceName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Removing server vulnerability assessment from a resource. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String resourceNamespace, String resourceType, String resourceName) { + return beginDeleteAsync(resourceGroupName, resourceNamespace, resourceType, resourceName).getSyncPoller(); + } + + /** + * Removing server vulnerability assessment from a resource. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String resourceNamespace, String resourceType, String resourceName, Context context) { + return beginDeleteAsync(resourceGroupName, resourceNamespace, resourceType, resourceName, context) + .getSyncPoller(); + } + + /** + * Removing server vulnerability assessment from a resource. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String resourceNamespace, String resourceType, String resourceName) { + return beginDeleteAsync(resourceGroupName, resourceNamespace, resourceType, resourceName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Removing server vulnerability assessment from a resource. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String resourceNamespace, String resourceType, String resourceName, Context context) { + return beginDeleteAsync(resourceGroupName, resourceNamespace, resourceType, resourceName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Removing server vulnerability assessment from a resource. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String resourceNamespace, String resourceType, String resourceName) { + deleteAsync(resourceGroupName, resourceNamespace, resourceType, resourceName).block(); + } + + /** + * Removing server vulnerability assessment from a resource. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete( + String resourceGroupName, String resourceNamespace, String resourceType, String resourceName, Context context) { + deleteAsync(resourceGroupName, resourceNamespace, resourceType, resourceName, context).block(); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ServerVulnerabilityAssessmentsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ServerVulnerabilityAssessmentsImpl.java new file mode 100644 index 000000000000..f0377d696819 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ServerVulnerabilityAssessmentsImpl.java @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.ServerVulnerabilityAssessmentsClient; +import com.azure.resourcemanager.security.fluent.models.ServerVulnerabilityAssessmentInner; +import com.azure.resourcemanager.security.fluent.models.ServerVulnerabilityAssessmentsListInner; +import com.azure.resourcemanager.security.models.ServerVulnerabilityAssessment; +import com.azure.resourcemanager.security.models.ServerVulnerabilityAssessments; +import com.azure.resourcemanager.security.models.ServerVulnerabilityAssessmentsList; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ServerVulnerabilityAssessmentsImpl implements ServerVulnerabilityAssessments { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServerVulnerabilityAssessmentsImpl.class); + + private final ServerVulnerabilityAssessmentsClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public ServerVulnerabilityAssessmentsImpl( + ServerVulnerabilityAssessmentsClient innerClient, + com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public ServerVulnerabilityAssessmentsList listByExtendedResource( + String resourceGroupName, String resourceNamespace, String resourceType, String resourceName) { + ServerVulnerabilityAssessmentsListInner inner = + this + .serviceClient() + .listByExtendedResource(resourceGroupName, resourceNamespace, resourceType, resourceName); + if (inner != null) { + return new ServerVulnerabilityAssessmentsListImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response listByExtendedResourceWithResponse( + String resourceGroupName, String resourceNamespace, String resourceType, String resourceName, Context context) { + Response inner = + this + .serviceClient() + .listByExtendedResourceWithResponse( + resourceGroupName, resourceNamespace, resourceType, resourceName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ServerVulnerabilityAssessmentsListImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ServerVulnerabilityAssessment get( + String resourceGroupName, String resourceNamespace, String resourceType, String resourceName) { + ServerVulnerabilityAssessmentInner inner = + this.serviceClient().get(resourceGroupName, resourceNamespace, resourceType, resourceName); + if (inner != null) { + return new ServerVulnerabilityAssessmentImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String resourceNamespace, String resourceType, String resourceName, Context context) { + Response inner = + this + .serviceClient() + .getWithResponse(resourceGroupName, resourceNamespace, resourceType, resourceName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ServerVulnerabilityAssessmentImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ServerVulnerabilityAssessment createOrUpdate( + String resourceGroupName, String resourceNamespace, String resourceType, String resourceName) { + ServerVulnerabilityAssessmentInner inner = + this.serviceClient().createOrUpdate(resourceGroupName, resourceNamespace, resourceType, resourceName); + if (inner != null) { + return new ServerVulnerabilityAssessmentImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response createOrUpdateWithResponse( + String resourceGroupName, String resourceNamespace, String resourceType, String resourceName, Context context) { + Response inner = + this + .serviceClient() + .createOrUpdateWithResponse(resourceGroupName, resourceNamespace, resourceType, resourceName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ServerVulnerabilityAssessmentImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String resourceNamespace, String resourceType, String resourceName) { + this.serviceClient().delete(resourceGroupName, resourceNamespace, resourceType, resourceName); + } + + public void delete( + String resourceGroupName, String resourceNamespace, String resourceType, String resourceName, Context context) { + this.serviceClient().delete(resourceGroupName, resourceNamespace, resourceType, resourceName, context); + } + + private ServerVulnerabilityAssessmentsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ServerVulnerabilityAssessmentsListImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ServerVulnerabilityAssessmentsListImpl.java new file mode 100644 index 000000000000..cc84ed836c77 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ServerVulnerabilityAssessmentsListImpl.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.resourcemanager.security.fluent.models.ServerVulnerabilityAssessmentInner; +import com.azure.resourcemanager.security.fluent.models.ServerVulnerabilityAssessmentsListInner; +import com.azure.resourcemanager.security.models.ServerVulnerabilityAssessment; +import com.azure.resourcemanager.security.models.ServerVulnerabilityAssessmentsList; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +public final class ServerVulnerabilityAssessmentsListImpl implements ServerVulnerabilityAssessmentsList { + private ServerVulnerabilityAssessmentsListInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + ServerVulnerabilityAssessmentsListImpl( + ServerVulnerabilityAssessmentsListInner innerObject, + com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public List value() { + List inner = this.innerModel().value(); + if (inner != null) { + return Collections + .unmodifiableList( + inner + .stream() + .map(inner1 -> new ServerVulnerabilityAssessmentImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return Collections.emptyList(); + } + } + + public ServerVulnerabilityAssessmentsListInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SettingImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SettingImpl.java new file mode 100644 index 000000000000..b1cc67401d2e --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SettingImpl.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.resourcemanager.security.fluent.models.SettingInner; +import com.azure.resourcemanager.security.models.Setting; + +public final class SettingImpl implements Setting { + private SettingInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + SettingImpl(SettingInner innerObject, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public SettingInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SettingsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SettingsClientImpl.java new file mode 100644 index 000000000000..03354fdad88f --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SettingsClientImpl.java @@ -0,0 +1,593 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.SettingsClient; +import com.azure.resourcemanager.security.fluent.models.SettingInner; +import com.azure.resourcemanager.security.models.SettingsList; +import com.azure.resourcemanager.security.models.SettingsSettingName; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in SettingsClient. */ +public final class SettingsClientImpl implements SettingsClient { + private final ClientLogger logger = new ClientLogger(SettingsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final SettingsService service; + + /** The service client containing this operation class. */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of SettingsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SettingsClientImpl(SecurityCenterImpl client) { + this.service = RestProxy.create(SettingsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterSettings to be used by the proxy service to perform + * REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityCenterSettin") + private interface SettingsService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings/{settingName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("settingName") SettingsSettingName settingName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put("/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings/{settingName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("settingName") SettingsSettingName settingName, + @BodyParam("application/json") SettingInner setting, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Settings about different configurations in security center. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return subscription settings list. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-06-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Settings about different configurations in security center. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return subscription settings list. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-06-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Settings about different configurations in security center. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return subscription settings list. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Settings about different configurations in security center. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return subscription settings list. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Settings about different configurations in security center. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return subscription settings list. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Settings about different configurations in security center. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return subscription settings list. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Settings of different configurations in security center. + * + * @param settingName The name of the setting. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the kind of the security setting. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(SettingsSettingName settingName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (settingName == null) { + return Mono.error(new IllegalArgumentException("Parameter settingName is required and cannot be null.")); + } + final String apiVersion = "2021-06-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + settingName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Settings of different configurations in security center. + * + * @param settingName The name of the setting. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the kind of the security setting. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(SettingsSettingName settingName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (settingName == null) { + return Mono.error(new IllegalArgumentException("Parameter settingName is required and cannot be null.")); + } + final String apiVersion = "2021-06-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), settingName, accept, context); + } + + /** + * Settings of different configurations in security center. + * + * @param settingName The name of the setting. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the kind of the security setting. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(SettingsSettingName settingName) { + return getWithResponseAsync(settingName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Settings of different configurations in security center. + * + * @param settingName The name of the setting. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the kind of the security setting. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SettingInner get(SettingsSettingName settingName) { + return getAsync(settingName).block(); + } + + /** + * Settings of different configurations in security center. + * + * @param settingName The name of the setting. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the kind of the security setting. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(SettingsSettingName settingName, Context context) { + return getWithResponseAsync(settingName, context).block(); + } + + /** + * updating settings about different configurations in security center. + * + * @param settingName The name of the setting. + * @param setting Setting object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the kind of the security setting. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + SettingsSettingName settingName, SettingInner setting) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (settingName == null) { + return Mono.error(new IllegalArgumentException("Parameter settingName is required and cannot be null.")); + } + if (setting == null) { + return Mono.error(new IllegalArgumentException("Parameter setting is required and cannot be null.")); + } else { + setting.validate(); + } + final String apiVersion = "2021-06-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + settingName, + setting, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * updating settings about different configurations in security center. + * + * @param settingName The name of the setting. + * @param setting Setting object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the kind of the security setting. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + SettingsSettingName settingName, SettingInner setting, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (settingName == null) { + return Mono.error(new IllegalArgumentException("Parameter settingName is required and cannot be null.")); + } + if (setting == null) { + return Mono.error(new IllegalArgumentException("Parameter setting is required and cannot be null.")); + } else { + setting.validate(); + } + final String apiVersion = "2021-06-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + settingName, + setting, + accept, + context); + } + + /** + * updating settings about different configurations in security center. + * + * @param settingName The name of the setting. + * @param setting Setting object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the kind of the security setting. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(SettingsSettingName settingName, SettingInner setting) { + return updateWithResponseAsync(settingName, setting) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * updating settings about different configurations in security center. + * + * @param settingName The name of the setting. + * @param setting Setting object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the kind of the security setting. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SettingInner update(SettingsSettingName settingName, SettingInner setting) { + return updateAsync(settingName, setting).block(); + } + + /** + * updating settings about different configurations in security center. + * + * @param settingName The name of the setting. + * @param setting Setting object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the kind of the security setting. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + SettingsSettingName settingName, SettingInner setting, Context context) { + return updateWithResponseAsync(settingName, setting, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return subscription settings list. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return subscription settings list. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SettingsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SettingsImpl.java new file mode 100644 index 000000000000..e34592b42d37 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SettingsImpl.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.SettingsClient; +import com.azure.resourcemanager.security.fluent.models.SettingInner; +import com.azure.resourcemanager.security.models.Setting; +import com.azure.resourcemanager.security.models.Settings; +import com.azure.resourcemanager.security.models.SettingsSettingName; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class SettingsImpl implements Settings { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SettingsImpl.class); + + private final SettingsClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public SettingsImpl(SettingsClient innerClient, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new SettingImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new SettingImpl(inner1, this.manager())); + } + + public Setting get(SettingsSettingName settingName) { + SettingInner inner = this.serviceClient().get(settingName); + if (inner != null) { + return new SettingImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse(SettingsSettingName settingName, Context context) { + Response inner = this.serviceClient().getWithResponse(settingName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new SettingImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Setting update(SettingsSettingName settingName, SettingInner setting) { + SettingInner inner = this.serviceClient().update(settingName, setting); + if (inner != null) { + return new SettingImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response updateWithResponse( + SettingsSettingName settingName, SettingInner setting, Context context) { + Response inner = this.serviceClient().updateWithResponse(settingName, setting, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new SettingImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private SettingsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SoftwareImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SoftwareImpl.java new file mode 100644 index 000000000000..53f34853574e --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SoftwareImpl.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.resourcemanager.security.fluent.models.SoftwareInner; +import com.azure.resourcemanager.security.models.EndOfSupportStatus; +import com.azure.resourcemanager.security.models.Software; + +public final class SoftwareImpl implements Software { + private SoftwareInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + SoftwareImpl(SoftwareInner innerObject, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String deviceId() { + return this.innerModel().deviceId(); + } + + public String osPlatform() { + return this.innerModel().osPlatform(); + } + + public String vendor() { + return this.innerModel().vendor(); + } + + public String softwareName() { + return this.innerModel().softwareName(); + } + + public String version() { + return this.innerModel().version(); + } + + public EndOfSupportStatus endOfSupportStatus() { + return this.innerModel().endOfSupportStatus(); + } + + public String endOfSupportDate() { + return this.innerModel().endOfSupportDate(); + } + + public Integer numberOfKnownVulnerabilities() { + return this.innerModel().numberOfKnownVulnerabilities(); + } + + public String firstSeenAt() { + return this.innerModel().firstSeenAt(); + } + + public SoftwareInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SoftwareInventoriesClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SoftwareInventoriesClientImpl.java new file mode 100644 index 000000000000..ffc044a02bac --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SoftwareInventoriesClientImpl.java @@ -0,0 +1,854 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.SoftwareInventoriesClient; +import com.azure.resourcemanager.security.fluent.models.SoftwareInner; +import com.azure.resourcemanager.security.models.SoftwaresList; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in SoftwareInventoriesClient. */ +public final class SoftwareInventoriesClientImpl implements SoftwareInventoriesClient { + private final ClientLogger logger = new ClientLogger(SoftwareInventoriesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final SoftwareInventoriesService service; + + /** The service client containing this operation class. */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of SoftwareInventoriesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SoftwareInventoriesClientImpl(SecurityCenterImpl client) { + this.service = + RestProxy.create(SoftwareInventoriesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterSoftwareInventories to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityCenterSoftwa") + private interface SoftwareInventoriesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}" + + "/{resourceType}/{resourceName}/providers/Microsoft.Security/softwareInventories") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByExtendedResource( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("resourceNamespace") String resourceNamespace, + @PathParam("resourceType") String resourceType, + @PathParam("resourceName") String resourceName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/softwareInventories") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}" + + "/{resourceType}/{resourceName}/providers/Microsoft.Security/softwareInventories/{softwareName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("resourceNamespace") String resourceNamespace, + @PathParam("resourceType") String resourceType, + @PathParam("resourceName") String resourceName, + @PathParam("softwareName") String softwareName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByExtendedResourceNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets the software inventory of the virtual machine. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param resourceNamespace The namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the software inventory of the virtual machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByExtendedResourceSinglePageAsync( + String resourceGroupName, String resourceNamespace, String resourceType, String resourceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourceNamespace == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceNamespace is required and cannot be null.")); + } + if (resourceType == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceType is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + final String apiVersion = "2021-05-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByExtendedResource( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceNamespace, + resourceType, + resourceName, + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the software inventory of the virtual machine. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param resourceNamespace The namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the software inventory of the virtual machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByExtendedResourceSinglePageAsync( + String resourceGroupName, String resourceNamespace, String resourceType, String resourceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourceNamespace == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceNamespace is required and cannot be null.")); + } + if (resourceType == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceType is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + final String apiVersion = "2021-05-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByExtendedResource( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceNamespace, + resourceType, + resourceName, + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets the software inventory of the virtual machine. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param resourceNamespace The namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the software inventory of the virtual machine. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByExtendedResourceAsync( + String resourceGroupName, String resourceNamespace, String resourceType, String resourceName) { + return new PagedFlux<>( + () -> + listByExtendedResourceSinglePageAsync(resourceGroupName, resourceNamespace, resourceType, resourceName), + nextLink -> listByExtendedResourceNextSinglePageAsync(nextLink)); + } + + /** + * Gets the software inventory of the virtual machine. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param resourceNamespace The namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the software inventory of the virtual machine. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByExtendedResourceAsync( + String resourceGroupName, String resourceNamespace, String resourceType, String resourceName, Context context) { + return new PagedFlux<>( + () -> + listByExtendedResourceSinglePageAsync( + resourceGroupName, resourceNamespace, resourceType, resourceName, context), + nextLink -> listByExtendedResourceNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets the software inventory of the virtual machine. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param resourceNamespace The namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the software inventory of the virtual machine. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByExtendedResource( + String resourceGroupName, String resourceNamespace, String resourceType, String resourceName) { + return new PagedIterable<>( + listByExtendedResourceAsync(resourceGroupName, resourceNamespace, resourceType, resourceName)); + } + + /** + * Gets the software inventory of the virtual machine. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param resourceNamespace The namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the software inventory of the virtual machine. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByExtendedResource( + String resourceGroupName, String resourceNamespace, String resourceType, String resourceName, Context context) { + return new PagedIterable<>( + listByExtendedResourceAsync(resourceGroupName, resourceNamespace, resourceType, resourceName, context)); + } + + /** + * Gets the software inventory of all virtual machines in the subscriptions. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the software inventory of all virtual machines in the subscriptions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-05-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list(this.client.getEndpoint(), this.client.getSubscriptionId(), apiVersion, accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the software inventory of all virtual machines in the subscriptions. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the software inventory of all virtual machines in the subscriptions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-05-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getSubscriptionId(), apiVersion, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets the software inventory of all virtual machines in the subscriptions. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the software inventory of all virtual machines in the subscriptions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>( + () -> listSinglePageAsync(), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * Gets the software inventory of all virtual machines in the subscriptions. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the software inventory of all virtual machines in the subscriptions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets the software inventory of all virtual machines in the subscriptions. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the software inventory of all virtual machines in the subscriptions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Gets the software inventory of all virtual machines in the subscriptions. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the software inventory of all virtual machines in the subscriptions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Gets a single software data of the virtual machine. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param resourceNamespace The namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @param softwareName Name of the installed software. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a single software data of the virtual machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String resourceNamespace, + String resourceType, + String resourceName, + String softwareName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourceNamespace == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceNamespace is required and cannot be null.")); + } + if (resourceType == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceType is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + if (softwareName == null) { + return Mono.error(new IllegalArgumentException("Parameter softwareName is required and cannot be null.")); + } + final String apiVersion = "2021-05-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceNamespace, + resourceType, + resourceName, + softwareName, + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a single software data of the virtual machine. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param resourceNamespace The namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @param softwareName Name of the installed software. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a single software data of the virtual machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String resourceNamespace, + String resourceType, + String resourceName, + String softwareName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourceNamespace == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceNamespace is required and cannot be null.")); + } + if (resourceType == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceType is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + if (softwareName == null) { + return Mono.error(new IllegalArgumentException("Parameter softwareName is required and cannot be null.")); + } + final String apiVersion = "2021-05-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceNamespace, + resourceType, + resourceName, + softwareName, + apiVersion, + accept, + context); + } + + /** + * Gets a single software data of the virtual machine. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param resourceNamespace The namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @param softwareName Name of the installed software. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a single software data of the virtual machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, + String resourceNamespace, + String resourceType, + String resourceName, + String softwareName) { + return getWithResponseAsync(resourceGroupName, resourceNamespace, resourceType, resourceName, softwareName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a single software data of the virtual machine. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param resourceNamespace The namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @param softwareName Name of the installed software. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a single software data of the virtual machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SoftwareInner get( + String resourceGroupName, + String resourceNamespace, + String resourceType, + String resourceName, + String softwareName) { + return getAsync(resourceGroupName, resourceNamespace, resourceType, resourceName, softwareName).block(); + } + + /** + * Gets a single software data of the virtual machine. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param resourceNamespace The namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @param softwareName Name of the installed software. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a single software data of the virtual machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String resourceNamespace, + String resourceType, + String resourceName, + String softwareName, + Context context) { + return getWithResponseAsync( + resourceGroupName, resourceNamespace, resourceType, resourceName, softwareName, context) + .block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents the software inventory of the virtual machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByExtendedResourceNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByExtendedResourceNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents the software inventory of the virtual machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByExtendedResourceNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByExtendedResourceNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents the software inventory of the virtual machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents the software inventory of the virtual machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SoftwareInventoriesImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SoftwareInventoriesImpl.java new file mode 100644 index 000000000000..555018226861 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SoftwareInventoriesImpl.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.SoftwareInventoriesClient; +import com.azure.resourcemanager.security.fluent.models.SoftwareInner; +import com.azure.resourcemanager.security.models.Software; +import com.azure.resourcemanager.security.models.SoftwareInventories; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class SoftwareInventoriesImpl implements SoftwareInventories { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SoftwareInventoriesImpl.class); + + private final SoftwareInventoriesClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public SoftwareInventoriesImpl( + SoftwareInventoriesClient innerClient, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByExtendedResource( + String resourceGroupName, String resourceNamespace, String resourceType, String resourceName) { + PagedIterable inner = + this + .serviceClient() + .listByExtendedResource(resourceGroupName, resourceNamespace, resourceType, resourceName); + return Utils.mapPage(inner, inner1 -> new SoftwareImpl(inner1, this.manager())); + } + + public PagedIterable listByExtendedResource( + String resourceGroupName, String resourceNamespace, String resourceType, String resourceName, Context context) { + PagedIterable inner = + this + .serviceClient() + .listByExtendedResource(resourceGroupName, resourceNamespace, resourceType, resourceName, context); + return Utils.mapPage(inner, inner1 -> new SoftwareImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new SoftwareImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new SoftwareImpl(inner1, this.manager())); + } + + public Software get( + String resourceGroupName, + String resourceNamespace, + String resourceType, + String resourceName, + String softwareName) { + SoftwareInner inner = + this.serviceClient().get(resourceGroupName, resourceNamespace, resourceType, resourceName, softwareName); + if (inner != null) { + return new SoftwareImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, + String resourceNamespace, + String resourceType, + String resourceName, + String softwareName, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse( + resourceGroupName, resourceNamespace, resourceType, resourceName, softwareName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new SoftwareImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private SoftwareInventoriesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SqlVulnerabilityAssessmentBaselineRulesClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SqlVulnerabilityAssessmentBaselineRulesClientImpl.java new file mode 100644 index 000000000000..62fc8e4da63d --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SqlVulnerabilityAssessmentBaselineRulesClientImpl.java @@ -0,0 +1,848 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.SqlVulnerabilityAssessmentBaselineRulesClient; +import com.azure.resourcemanager.security.fluent.models.RuleResultsInner; +import com.azure.resourcemanager.security.fluent.models.RulesResultsInner; +import com.azure.resourcemanager.security.models.RuleResultsInput; +import com.azure.resourcemanager.security.models.RulesResultsInput; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in + * SqlVulnerabilityAssessmentBaselineRulesClient. + */ +public final class SqlVulnerabilityAssessmentBaselineRulesClientImpl + implements SqlVulnerabilityAssessmentBaselineRulesClient { + private final ClientLogger logger = new ClientLogger(SqlVulnerabilityAssessmentBaselineRulesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final SqlVulnerabilityAssessmentBaselineRulesService service; + + /** The service client containing this operation class. */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of SqlVulnerabilityAssessmentBaselineRulesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SqlVulnerabilityAssessmentBaselineRulesClientImpl(SecurityCenterImpl client) { + this.service = + RestProxy + .create( + SqlVulnerabilityAssessmentBaselineRulesService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterSqlVulnerabilityAssessmentBaselineRules to be used by + * the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityCenterSqlVul") + private interface SqlVulnerabilityAssessmentBaselineRulesService { + @Headers({"Content-Type: application/json"}) + @Put("/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/baselineRules/{ruleId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("ruleId") String ruleId, + @QueryParam("workspaceId") String workspaceId, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceId", encoded = true) String resourceId, + @BodyParam("application/json") RuleResultsInput body, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/baselineRules/{ruleId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("ruleId") String ruleId, + @QueryParam("workspaceId") String workspaceId, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceId", encoded = true) String resourceId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete("/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/baselineRules/{ruleId}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("ruleId") String ruleId, + @QueryParam("workspaceId") String workspaceId, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceId", encoded = true) String resourceId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/baselineRules") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("workspaceId") String workspaceId, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceId", encoded = true) String resourceId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post("/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/baselineRules") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> add( + @HostParam("$host") String endpoint, + @QueryParam("workspaceId") String workspaceId, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceId", encoded = true) String resourceId, + @BodyParam("application/json") RulesResultsInput body, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Creates a Baseline for a rule in a database. Will overwrite any previously existing results. + * + * @param ruleId The rule Id. + * @param workspaceId The workspace Id. + * @param resourceId The identifier of the resource. + * @param body The baseline results for this rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return rule results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String ruleId, String workspaceId, String resourceId, RuleResultsInput body) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (ruleId == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleId is required and cannot be null.")); + } + if (workspaceId == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceId is required and cannot be null.")); + } + if (resourceId == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); + } + if (body != null) { + body.validate(); + } + final String apiVersion = "2020-07-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + ruleId, + workspaceId, + apiVersion, + resourceId, + body, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates a Baseline for a rule in a database. Will overwrite any previously existing results. + * + * @param ruleId The rule Id. + * @param workspaceId The workspace Id. + * @param resourceId The identifier of the resource. + * @param body The baseline results for this rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return rule results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String ruleId, String workspaceId, String resourceId, RuleResultsInput body, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (ruleId == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleId is required and cannot be null.")); + } + if (workspaceId == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceId is required and cannot be null.")); + } + if (resourceId == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); + } + if (body != null) { + body.validate(); + } + final String apiVersion = "2020-07-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), ruleId, workspaceId, apiVersion, resourceId, body, accept, context); + } + + /** + * Creates a Baseline for a rule in a database. Will overwrite any previously existing results. + * + * @param ruleId The rule Id. + * @param workspaceId The workspace Id. + * @param resourceId The identifier of the resource. + * @param body The baseline results for this rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return rule results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String ruleId, String workspaceId, String resourceId, RuleResultsInput body) { + return createOrUpdateWithResponseAsync(ruleId, workspaceId, resourceId, body) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Creates a Baseline for a rule in a database. Will overwrite any previously existing results. + * + * @param ruleId The rule Id. + * @param workspaceId The workspace Id. + * @param resourceId The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return rule results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String ruleId, String workspaceId, String resourceId) { + final RuleResultsInput body = null; + return createOrUpdateWithResponseAsync(ruleId, workspaceId, resourceId, body) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Creates a Baseline for a rule in a database. Will overwrite any previously existing results. + * + * @param ruleId The rule Id. + * @param workspaceId The workspace Id. + * @param resourceId The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return rule results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RuleResultsInner createOrUpdate(String ruleId, String workspaceId, String resourceId) { + final RuleResultsInput body = null; + return createOrUpdateAsync(ruleId, workspaceId, resourceId, body).block(); + } + + /** + * Creates a Baseline for a rule in a database. Will overwrite any previously existing results. + * + * @param ruleId The rule Id. + * @param workspaceId The workspace Id. + * @param resourceId The identifier of the resource. + * @param body The baseline results for this rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return rule results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String ruleId, String workspaceId, String resourceId, RuleResultsInput body, Context context) { + return createOrUpdateWithResponseAsync(ruleId, workspaceId, resourceId, body, context).block(); + } + + /** + * Gets the results for a given rule in the Baseline. + * + * @param ruleId The rule Id. + * @param workspaceId The workspace Id. + * @param resourceId The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the results for a given rule in the Baseline. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String ruleId, String workspaceId, String resourceId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (ruleId == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleId is required and cannot be null.")); + } + if (workspaceId == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceId is required and cannot be null.")); + } + if (resourceId == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); + } + final String apiVersion = "2020-07-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get(this.client.getEndpoint(), ruleId, workspaceId, apiVersion, resourceId, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the results for a given rule in the Baseline. + * + * @param ruleId The rule Id. + * @param workspaceId The workspace Id. + * @param resourceId The identifier of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the results for a given rule in the Baseline. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String ruleId, String workspaceId, String resourceId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (ruleId == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleId is required and cannot be null.")); + } + if (workspaceId == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceId is required and cannot be null.")); + } + if (resourceId == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); + } + final String apiVersion = "2020-07-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), ruleId, workspaceId, apiVersion, resourceId, accept, context); + } + + /** + * Gets the results for a given rule in the Baseline. + * + * @param ruleId The rule Id. + * @param workspaceId The workspace Id. + * @param resourceId The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the results for a given rule in the Baseline. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String ruleId, String workspaceId, String resourceId) { + return getWithResponseAsync(ruleId, workspaceId, resourceId) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the results for a given rule in the Baseline. + * + * @param ruleId The rule Id. + * @param workspaceId The workspace Id. + * @param resourceId The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the results for a given rule in the Baseline. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RuleResultsInner get(String ruleId, String workspaceId, String resourceId) { + return getAsync(ruleId, workspaceId, resourceId).block(); + } + + /** + * Gets the results for a given rule in the Baseline. + * + * @param ruleId The rule Id. + * @param workspaceId The workspace Id. + * @param resourceId The identifier of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the results for a given rule in the Baseline. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String ruleId, String workspaceId, String resourceId, Context context) { + return getWithResponseAsync(ruleId, workspaceId, resourceId, context).block(); + } + + /** + * Deletes a rule from the Baseline of a given database. + * + * @param ruleId The rule Id. + * @param workspaceId The workspace Id. + * @param resourceId The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String ruleId, String workspaceId, String resourceId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (ruleId == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleId is required and cannot be null.")); + } + if (workspaceId == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceId is required and cannot be null.")); + } + if (resourceId == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); + } + final String apiVersion = "2020-07-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), ruleId, workspaceId, apiVersion, resourceId, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a rule from the Baseline of a given database. + * + * @param ruleId The rule Id. + * @param workspaceId The workspace Id. + * @param resourceId The identifier of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String ruleId, String workspaceId, String resourceId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (ruleId == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleId is required and cannot be null.")); + } + if (workspaceId == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceId is required and cannot be null.")); + } + if (resourceId == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); + } + final String apiVersion = "2020-07-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), ruleId, workspaceId, apiVersion, resourceId, accept, context); + } + + /** + * Deletes a rule from the Baseline of a given database. + * + * @param ruleId The rule Id. + * @param workspaceId The workspace Id. + * @param resourceId The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String ruleId, String workspaceId, String resourceId) { + return deleteWithResponseAsync(ruleId, workspaceId, resourceId).flatMap((Response res) -> Mono.empty()); + } + + /** + * Deletes a rule from the Baseline of a given database. + * + * @param ruleId The rule Id. + * @param workspaceId The workspace Id. + * @param resourceId The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String ruleId, String workspaceId, String resourceId) { + deleteAsync(ruleId, workspaceId, resourceId).block(); + } + + /** + * Deletes a rule from the Baseline of a given database. + * + * @param ruleId The rule Id. + * @param workspaceId The workspace Id. + * @param resourceId The identifier of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String ruleId, String workspaceId, String resourceId, Context context) { + return deleteWithResponseAsync(ruleId, workspaceId, resourceId, context).block(); + } + + /** + * Gets the results for all rules in the Baseline. + * + * @param workspaceId The workspace Id. + * @param resourceId The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the results for all rules in the Baseline. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listWithResponseAsync(String workspaceId, String resourceId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (workspaceId == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceId is required and cannot be null.")); + } + if (resourceId == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); + } + final String apiVersion = "2020-07-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service.list(this.client.getEndpoint(), workspaceId, apiVersion, resourceId, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the results for all rules in the Baseline. + * + * @param workspaceId The workspace Id. + * @param resourceId The identifier of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the results for all rules in the Baseline. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listWithResponseAsync( + String workspaceId, String resourceId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (workspaceId == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceId is required and cannot be null.")); + } + if (resourceId == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); + } + final String apiVersion = "2020-07-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.list(this.client.getEndpoint(), workspaceId, apiVersion, resourceId, accept, context); + } + + /** + * Gets the results for all rules in the Baseline. + * + * @param workspaceId The workspace Id. + * @param resourceId The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the results for all rules in the Baseline. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listAsync(String workspaceId, String resourceId) { + return listWithResponseAsync(workspaceId, resourceId) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the results for all rules in the Baseline. + * + * @param workspaceId The workspace Id. + * @param resourceId The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the results for all rules in the Baseline. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RulesResultsInner list(String workspaceId, String resourceId) { + return listAsync(workspaceId, resourceId).block(); + } + + /** + * Gets the results for all rules in the Baseline. + * + * @param workspaceId The workspace Id. + * @param resourceId The identifier of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the results for all rules in the Baseline. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listWithResponse(String workspaceId, String resourceId, Context context) { + return listWithResponseAsync(workspaceId, resourceId, context).block(); + } + + /** + * Add a list of baseline rules. Will overwrite any previously existing results (for all rules). + * + * @param workspaceId The workspace Id. + * @param resourceId The identifier of the resource. + * @param body The baseline rules. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of rules results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> addWithResponseAsync( + String workspaceId, String resourceId, RulesResultsInput body) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (workspaceId == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceId is required and cannot be null.")); + } + if (resourceId == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); + } + if (body != null) { + body.validate(); + } + final String apiVersion = "2020-07-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service.add(this.client.getEndpoint(), workspaceId, apiVersion, resourceId, body, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Add a list of baseline rules. Will overwrite any previously existing results (for all rules). + * + * @param workspaceId The workspace Id. + * @param resourceId The identifier of the resource. + * @param body The baseline rules. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of rules results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> addWithResponseAsync( + String workspaceId, String resourceId, RulesResultsInput body, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (workspaceId == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceId is required and cannot be null.")); + } + if (resourceId == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); + } + if (body != null) { + body.validate(); + } + final String apiVersion = "2020-07-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.add(this.client.getEndpoint(), workspaceId, apiVersion, resourceId, body, accept, context); + } + + /** + * Add a list of baseline rules. Will overwrite any previously existing results (for all rules). + * + * @param workspaceId The workspace Id. + * @param resourceId The identifier of the resource. + * @param body The baseline rules. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of rules results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono addAsync(String workspaceId, String resourceId, RulesResultsInput body) { + return addWithResponseAsync(workspaceId, resourceId, body) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Add a list of baseline rules. Will overwrite any previously existing results (for all rules). + * + * @param workspaceId The workspace Id. + * @param resourceId The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of rules results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono addAsync(String workspaceId, String resourceId) { + final RulesResultsInput body = null; + return addWithResponseAsync(workspaceId, resourceId, body) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Add a list of baseline rules. Will overwrite any previously existing results (for all rules). + * + * @param workspaceId The workspace Id. + * @param resourceId The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of rules results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RulesResultsInner add(String workspaceId, String resourceId) { + final RulesResultsInput body = null; + return addAsync(workspaceId, resourceId, body).block(); + } + + /** + * Add a list of baseline rules. Will overwrite any previously existing results (for all rules). + * + * @param workspaceId The workspace Id. + * @param resourceId The identifier of the resource. + * @param body The baseline rules. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of rules results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response addWithResponse( + String workspaceId, String resourceId, RulesResultsInput body, Context context) { + return addWithResponseAsync(workspaceId, resourceId, body, context).block(); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SqlVulnerabilityAssessmentBaselineRulesImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SqlVulnerabilityAssessmentBaselineRulesImpl.java new file mode 100644 index 000000000000..fdb604b8241e --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SqlVulnerabilityAssessmentBaselineRulesImpl.java @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.SqlVulnerabilityAssessmentBaselineRulesClient; +import com.azure.resourcemanager.security.fluent.models.RuleResultsInner; +import com.azure.resourcemanager.security.fluent.models.RulesResultsInner; +import com.azure.resourcemanager.security.models.RuleResults; +import com.azure.resourcemanager.security.models.RulesResults; +import com.azure.resourcemanager.security.models.RulesResultsInput; +import com.azure.resourcemanager.security.models.SqlVulnerabilityAssessmentBaselineRules; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class SqlVulnerabilityAssessmentBaselineRulesImpl implements SqlVulnerabilityAssessmentBaselineRules { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SqlVulnerabilityAssessmentBaselineRulesImpl.class); + + private final SqlVulnerabilityAssessmentBaselineRulesClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public SqlVulnerabilityAssessmentBaselineRulesImpl( + SqlVulnerabilityAssessmentBaselineRulesClient innerClient, + com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public RuleResults get(String ruleId, String workspaceId, String resourceId) { + RuleResultsInner inner = this.serviceClient().get(ruleId, workspaceId, resourceId); + if (inner != null) { + return new RuleResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String ruleId, String workspaceId, String resourceId, Context context) { + Response inner = + this.serviceClient().getWithResponse(ruleId, workspaceId, resourceId, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new RuleResultsImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String ruleId, String workspaceId, String resourceId) { + this.serviceClient().delete(ruleId, workspaceId, resourceId); + } + + public Response deleteWithResponse(String ruleId, String workspaceId, String resourceId, Context context) { + return this.serviceClient().deleteWithResponse(ruleId, workspaceId, resourceId, context); + } + + public RulesResults list(String workspaceId, String resourceId) { + RulesResultsInner inner = this.serviceClient().list(workspaceId, resourceId); + if (inner != null) { + return new RulesResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response listWithResponse(String workspaceId, String resourceId, Context context) { + Response inner = this.serviceClient().listWithResponse(workspaceId, resourceId, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new RulesResultsImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public RulesResults add(String workspaceId, String resourceId) { + RulesResultsInner inner = this.serviceClient().add(workspaceId, resourceId); + if (inner != null) { + return new RulesResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response addWithResponse( + String workspaceId, String resourceId, RulesResultsInput body, Context context) { + Response inner = + this.serviceClient().addWithResponse(workspaceId, resourceId, body, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new RulesResultsImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private SqlVulnerabilityAssessmentBaselineRulesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } + + public RuleResultsImpl define(String name) { + return new RuleResultsImpl(name, this.manager()); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SqlVulnerabilityAssessmentScanResultsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SqlVulnerabilityAssessmentScanResultsClientImpl.java new file mode 100644 index 000000000000..4d9af23168ea --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SqlVulnerabilityAssessmentScanResultsClientImpl.java @@ -0,0 +1,382 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.SqlVulnerabilityAssessmentScanResultsClient; +import com.azure.resourcemanager.security.fluent.models.ScanResultInner; +import com.azure.resourcemanager.security.fluent.models.ScanResultsInner; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in + * SqlVulnerabilityAssessmentScanResultsClient. + */ +public final class SqlVulnerabilityAssessmentScanResultsClientImpl + implements SqlVulnerabilityAssessmentScanResultsClient { + private final ClientLogger logger = new ClientLogger(SqlVulnerabilityAssessmentScanResultsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final SqlVulnerabilityAssessmentScanResultsService service; + + /** The service client containing this operation class. */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of SqlVulnerabilityAssessmentScanResultsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SqlVulnerabilityAssessmentScanResultsClientImpl(SecurityCenterImpl client) { + this.service = + RestProxy + .create( + SqlVulnerabilityAssessmentScanResultsService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterSqlVulnerabilityAssessmentScanResults to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityCenterSqlVul") + private interface SqlVulnerabilityAssessmentScanResultsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/scans/{scanId}/scanResults" + + "/{scanResultId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("scanId") String scanId, + @PathParam("scanResultId") String scanResultId, + @QueryParam("workspaceId") String workspaceId, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceId", encoded = true) String resourceId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/scans/{scanId}/scanResults") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("scanId") String scanId, + @QueryParam("workspaceId") String workspaceId, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceId", encoded = true) String resourceId, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets the scan results of a single rule in a scan record. + * + * @param scanId The scan Id. Type 'latest' to get the scan results for the latest scan. + * @param scanResultId The rule Id of the results. + * @param workspaceId The workspace Id. + * @param resourceId The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the scan results of a single rule in a scan record. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String scanId, String scanResultId, String workspaceId, String resourceId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scanId == null) { + return Mono.error(new IllegalArgumentException("Parameter scanId is required and cannot be null.")); + } + if (scanResultId == null) { + return Mono.error(new IllegalArgumentException("Parameter scanResultId is required and cannot be null.")); + } + if (workspaceId == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceId is required and cannot be null.")); + } + if (resourceId == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); + } + final String apiVersion = "2020-07-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + scanId, + scanResultId, + workspaceId, + apiVersion, + resourceId, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the scan results of a single rule in a scan record. + * + * @param scanId The scan Id. Type 'latest' to get the scan results for the latest scan. + * @param scanResultId The rule Id of the results. + * @param workspaceId The workspace Id. + * @param resourceId The identifier of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the scan results of a single rule in a scan record. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String scanId, String scanResultId, String workspaceId, String resourceId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scanId == null) { + return Mono.error(new IllegalArgumentException("Parameter scanId is required and cannot be null.")); + } + if (scanResultId == null) { + return Mono.error(new IllegalArgumentException("Parameter scanResultId is required and cannot be null.")); + } + if (workspaceId == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceId is required and cannot be null.")); + } + if (resourceId == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); + } + final String apiVersion = "2020-07-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get(this.client.getEndpoint(), scanId, scanResultId, workspaceId, apiVersion, resourceId, accept, context); + } + + /** + * Gets the scan results of a single rule in a scan record. + * + * @param scanId The scan Id. Type 'latest' to get the scan results for the latest scan. + * @param scanResultId The rule Id of the results. + * @param workspaceId The workspace Id. + * @param resourceId The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the scan results of a single rule in a scan record. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String scanId, String scanResultId, String workspaceId, String resourceId) { + return getWithResponseAsync(scanId, scanResultId, workspaceId, resourceId) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the scan results of a single rule in a scan record. + * + * @param scanId The scan Id. Type 'latest' to get the scan results for the latest scan. + * @param scanResultId The rule Id of the results. + * @param workspaceId The workspace Id. + * @param resourceId The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the scan results of a single rule in a scan record. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ScanResultInner get(String scanId, String scanResultId, String workspaceId, String resourceId) { + return getAsync(scanId, scanResultId, workspaceId, resourceId).block(); + } + + /** + * Gets the scan results of a single rule in a scan record. + * + * @param scanId The scan Id. Type 'latest' to get the scan results for the latest scan. + * @param scanResultId The rule Id of the results. + * @param workspaceId The workspace Id. + * @param resourceId The identifier of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the scan results of a single rule in a scan record. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String scanId, String scanResultId, String workspaceId, String resourceId, Context context) { + return getWithResponseAsync(scanId, scanResultId, workspaceId, resourceId, context).block(); + } + + /** + * Gets a list of scan results for a single scan record. + * + * @param scanId The scan Id. Type 'latest' to get the scan results for the latest scan. + * @param workspaceId The workspace Id. + * @param resourceId The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of scan results for a single scan record. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listWithResponseAsync( + String scanId, String workspaceId, String resourceId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scanId == null) { + return Mono.error(new IllegalArgumentException("Parameter scanId is required and cannot be null.")); + } + if (workspaceId == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceId is required and cannot be null.")); + } + if (resourceId == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); + } + final String apiVersion = "2020-07-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list(this.client.getEndpoint(), scanId, workspaceId, apiVersion, resourceId, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of scan results for a single scan record. + * + * @param scanId The scan Id. Type 'latest' to get the scan results for the latest scan. + * @param workspaceId The workspace Id. + * @param resourceId The identifier of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of scan results for a single scan record. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listWithResponseAsync( + String scanId, String workspaceId, String resourceId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scanId == null) { + return Mono.error(new IllegalArgumentException("Parameter scanId is required and cannot be null.")); + } + if (workspaceId == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceId is required and cannot be null.")); + } + if (resourceId == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); + } + final String apiVersion = "2020-07-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.list(this.client.getEndpoint(), scanId, workspaceId, apiVersion, resourceId, accept, context); + } + + /** + * Gets a list of scan results for a single scan record. + * + * @param scanId The scan Id. Type 'latest' to get the scan results for the latest scan. + * @param workspaceId The workspace Id. + * @param resourceId The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of scan results for a single scan record. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listAsync(String scanId, String workspaceId, String resourceId) { + return listWithResponseAsync(scanId, workspaceId, resourceId) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a list of scan results for a single scan record. + * + * @param scanId The scan Id. Type 'latest' to get the scan results for the latest scan. + * @param workspaceId The workspace Id. + * @param resourceId The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of scan results for a single scan record. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ScanResultsInner list(String scanId, String workspaceId, String resourceId) { + return listAsync(scanId, workspaceId, resourceId).block(); + } + + /** + * Gets a list of scan results for a single scan record. + * + * @param scanId The scan Id. Type 'latest' to get the scan results for the latest scan. + * @param workspaceId The workspace Id. + * @param resourceId The identifier of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of scan results for a single scan record. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listWithResponse( + String scanId, String workspaceId, String resourceId, Context context) { + return listWithResponseAsync(scanId, workspaceId, resourceId, context).block(); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SqlVulnerabilityAssessmentScanResultsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SqlVulnerabilityAssessmentScanResultsImpl.java new file mode 100644 index 000000000000..cc64fc04c4ac --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SqlVulnerabilityAssessmentScanResultsImpl.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.SqlVulnerabilityAssessmentScanResultsClient; +import com.azure.resourcemanager.security.fluent.models.ScanResultInner; +import com.azure.resourcemanager.security.fluent.models.ScanResultsInner; +import com.azure.resourcemanager.security.models.ScanResult; +import com.azure.resourcemanager.security.models.ScanResults; +import com.azure.resourcemanager.security.models.SqlVulnerabilityAssessmentScanResults; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class SqlVulnerabilityAssessmentScanResultsImpl implements SqlVulnerabilityAssessmentScanResults { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SqlVulnerabilityAssessmentScanResultsImpl.class); + + private final SqlVulnerabilityAssessmentScanResultsClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public SqlVulnerabilityAssessmentScanResultsImpl( + SqlVulnerabilityAssessmentScanResultsClient innerClient, + com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public ScanResult get(String scanId, String scanResultId, String workspaceId, String resourceId) { + ScanResultInner inner = this.serviceClient().get(scanId, scanResultId, workspaceId, resourceId); + if (inner != null) { + return new ScanResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String scanId, String scanResultId, String workspaceId, String resourceId, Context context) { + Response inner = + this.serviceClient().getWithResponse(scanId, scanResultId, workspaceId, resourceId, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ScanResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ScanResults list(String scanId, String workspaceId, String resourceId) { + ScanResultsInner inner = this.serviceClient().list(scanId, workspaceId, resourceId); + if (inner != null) { + return new ScanResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response listWithResponse( + String scanId, String workspaceId, String resourceId, Context context) { + Response inner = + this.serviceClient().listWithResponse(scanId, workspaceId, resourceId, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ScanResultsImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private SqlVulnerabilityAssessmentScanResultsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SqlVulnerabilityAssessmentScansClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SqlVulnerabilityAssessmentScansClientImpl.java new file mode 100644 index 000000000000..8151faacb118 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SqlVulnerabilityAssessmentScansClientImpl.java @@ -0,0 +1,336 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.SqlVulnerabilityAssessmentScansClient; +import com.azure.resourcemanager.security.fluent.models.ScanInner; +import com.azure.resourcemanager.security.fluent.models.ScansInner; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in SqlVulnerabilityAssessmentScansClient. */ +public final class SqlVulnerabilityAssessmentScansClientImpl implements SqlVulnerabilityAssessmentScansClient { + private final ClientLogger logger = new ClientLogger(SqlVulnerabilityAssessmentScansClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final SqlVulnerabilityAssessmentScansService service; + + /** The service client containing this operation class. */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of SqlVulnerabilityAssessmentScansClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SqlVulnerabilityAssessmentScansClientImpl(SecurityCenterImpl client) { + this.service = + RestProxy + .create( + SqlVulnerabilityAssessmentScansService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterSqlVulnerabilityAssessmentScans to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityCenterSqlVul") + private interface SqlVulnerabilityAssessmentScansService { + @Headers({"Content-Type: application/json"}) + @Get("/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/scans/{scanId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("scanId") String scanId, + @QueryParam("workspaceId") String workspaceId, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceId", encoded = true) String resourceId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/scans") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("workspaceId") String workspaceId, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceId", encoded = true) String resourceId, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets the scan details of a single scan record. + * + * @param scanId The scan Id. Type 'latest' to get the scan record for the latest scan. + * @param workspaceId The workspace Id. + * @param resourceId The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the scan details of a single scan record. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String scanId, String workspaceId, String resourceId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scanId == null) { + return Mono.error(new IllegalArgumentException("Parameter scanId is required and cannot be null.")); + } + if (workspaceId == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceId is required and cannot be null.")); + } + if (resourceId == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); + } + final String apiVersion = "2020-07-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get(this.client.getEndpoint(), scanId, workspaceId, apiVersion, resourceId, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the scan details of a single scan record. + * + * @param scanId The scan Id. Type 'latest' to get the scan record for the latest scan. + * @param workspaceId The workspace Id. + * @param resourceId The identifier of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the scan details of a single scan record. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String scanId, String workspaceId, String resourceId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scanId == null) { + return Mono.error(new IllegalArgumentException("Parameter scanId is required and cannot be null.")); + } + if (workspaceId == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceId is required and cannot be null.")); + } + if (resourceId == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); + } + final String apiVersion = "2020-07-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), scanId, workspaceId, apiVersion, resourceId, accept, context); + } + + /** + * Gets the scan details of a single scan record. + * + * @param scanId The scan Id. Type 'latest' to get the scan record for the latest scan. + * @param workspaceId The workspace Id. + * @param resourceId The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the scan details of a single scan record. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String scanId, String workspaceId, String resourceId) { + return getWithResponseAsync(scanId, workspaceId, resourceId) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the scan details of a single scan record. + * + * @param scanId The scan Id. Type 'latest' to get the scan record for the latest scan. + * @param workspaceId The workspace Id. + * @param resourceId The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the scan details of a single scan record. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ScanInner get(String scanId, String workspaceId, String resourceId) { + return getAsync(scanId, workspaceId, resourceId).block(); + } + + /** + * Gets the scan details of a single scan record. + * + * @param scanId The scan Id. Type 'latest' to get the scan record for the latest scan. + * @param workspaceId The workspace Id. + * @param resourceId The identifier of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the scan details of a single scan record. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String scanId, String workspaceId, String resourceId, Context context) { + return getWithResponseAsync(scanId, workspaceId, resourceId, context).block(); + } + + /** + * Gets a list of scan records. + * + * @param workspaceId The workspace Id. + * @param resourceId The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of scan records. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listWithResponseAsync(String workspaceId, String resourceId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (workspaceId == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceId is required and cannot be null.")); + } + if (resourceId == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); + } + final String apiVersion = "2020-07-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service.list(this.client.getEndpoint(), workspaceId, apiVersion, resourceId, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of scan records. + * + * @param workspaceId The workspace Id. + * @param resourceId The identifier of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of scan records. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listWithResponseAsync(String workspaceId, String resourceId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (workspaceId == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceId is required and cannot be null.")); + } + if (resourceId == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); + } + final String apiVersion = "2020-07-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.list(this.client.getEndpoint(), workspaceId, apiVersion, resourceId, accept, context); + } + + /** + * Gets a list of scan records. + * + * @param workspaceId The workspace Id. + * @param resourceId The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of scan records. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listAsync(String workspaceId, String resourceId) { + return listWithResponseAsync(workspaceId, resourceId) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a list of scan records. + * + * @param workspaceId The workspace Id. + * @param resourceId The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of scan records. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ScansInner list(String workspaceId, String resourceId) { + return listAsync(workspaceId, resourceId).block(); + } + + /** + * Gets a list of scan records. + * + * @param workspaceId The workspace Id. + * @param resourceId The identifier of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of scan records. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listWithResponse(String workspaceId, String resourceId, Context context) { + return listWithResponseAsync(workspaceId, resourceId, context).block(); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SqlVulnerabilityAssessmentScansImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SqlVulnerabilityAssessmentScansImpl.java new file mode 100644 index 000000000000..21d493736065 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SqlVulnerabilityAssessmentScansImpl.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.SqlVulnerabilityAssessmentScansClient; +import com.azure.resourcemanager.security.fluent.models.ScanInner; +import com.azure.resourcemanager.security.fluent.models.ScansInner; +import com.azure.resourcemanager.security.models.Scan; +import com.azure.resourcemanager.security.models.Scans; +import com.azure.resourcemanager.security.models.SqlVulnerabilityAssessmentScans; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class SqlVulnerabilityAssessmentScansImpl implements SqlVulnerabilityAssessmentScans { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SqlVulnerabilityAssessmentScansImpl.class); + + private final SqlVulnerabilityAssessmentScansClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public SqlVulnerabilityAssessmentScansImpl( + SqlVulnerabilityAssessmentScansClient innerClient, + com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Scan get(String scanId, String workspaceId, String resourceId) { + ScanInner inner = this.serviceClient().get(scanId, workspaceId, resourceId); + if (inner != null) { + return new ScanImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse(String scanId, String workspaceId, String resourceId, Context context) { + Response inner = this.serviceClient().getWithResponse(scanId, workspaceId, resourceId, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ScanImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Scans list(String workspaceId, String resourceId) { + ScansInner inner = this.serviceClient().list(workspaceId, resourceId); + if (inner != null) { + return new ScansImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response listWithResponse(String workspaceId, String resourceId, Context context) { + Response inner = this.serviceClient().listWithResponse(workspaceId, resourceId, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ScansImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private SqlVulnerabilityAssessmentScansClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SubAssessmentsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SubAssessmentsClientImpl.java new file mode 100644 index 000000000000..e7eaad0d5ebb --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SubAssessmentsClientImpl.java @@ -0,0 +1,701 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.SubAssessmentsClient; +import com.azure.resourcemanager.security.fluent.models.SecuritySubAssessmentInner; +import com.azure.resourcemanager.security.models.SecuritySubAssessmentList; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in SubAssessmentsClient. */ +public final class SubAssessmentsClientImpl implements SubAssessmentsClient { + private final ClientLogger logger = new ClientLogger(SubAssessmentsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final SubAssessmentsService service; + + /** The service client containing this operation class. */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of SubAssessmentsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SubAssessmentsClientImpl(SecurityCenterImpl client) { + this.service = + RestProxy.create(SubAssessmentsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterSubAssessments to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityCenterSubAss") + private interface SubAssessmentsService { + @Headers({"Content-Type: application/json"}) + @Get("/{scope}/providers/Microsoft.Security/subAssessments") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listAll( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "scope", encoded = true) String scope, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/subAssessments") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "scope", encoded = true) String scope, + @PathParam("assessmentName") String assessmentName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/subAssessments/{subAssessmentName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "scope", encoded = true) String scope, + @PathParam("assessmentName") String assessmentName, + @PathParam("subAssessmentName") String subAssessmentName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listAllNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Get security sub-assessments on all your scanned resources inside a subscription scope. + * + * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return security sub-assessments on all your scanned resources inside a subscription scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAllSinglePageAsync(String scope) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + final String apiVersion = "2019-01-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listAll(this.client.getEndpoint(), apiVersion, scope, accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get security sub-assessments on all your scanned resources inside a subscription scope. + * + * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return security sub-assessments on all your scanned resources inside a subscription scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAllSinglePageAsync(String scope, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + final String apiVersion = "2019-01-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listAll(this.client.getEndpoint(), apiVersion, scope, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get security sub-assessments on all your scanned resources inside a subscription scope. + * + * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return security sub-assessments on all your scanned resources inside a subscription scope. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAllAsync(String scope) { + return new PagedFlux<>(() -> listAllSinglePageAsync(scope), nextLink -> listAllNextSinglePageAsync(nextLink)); + } + + /** + * Get security sub-assessments on all your scanned resources inside a subscription scope. + * + * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return security sub-assessments on all your scanned resources inside a subscription scope. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAllAsync(String scope, Context context) { + return new PagedFlux<>( + () -> listAllSinglePageAsync(scope, context), nextLink -> listAllNextSinglePageAsync(nextLink, context)); + } + + /** + * Get security sub-assessments on all your scanned resources inside a subscription scope. + * + * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return security sub-assessments on all your scanned resources inside a subscription scope. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listAll(String scope) { + return new PagedIterable<>(listAllAsync(scope)); + } + + /** + * Get security sub-assessments on all your scanned resources inside a subscription scope. + * + * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return security sub-assessments on all your scanned resources inside a subscription scope. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listAll(String scope, Context context) { + return new PagedIterable<>(listAllAsync(scope, context)); + } + + /** + * Get security sub-assessments on all your scanned resources inside a scope. + * + * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @param assessmentName The Assessment Key - Unique key for the assessment type. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return security sub-assessments on all your scanned resources inside a scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String scope, String assessmentName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (assessmentName == null) { + return Mono.error(new IllegalArgumentException("Parameter assessmentName is required and cannot be null.")); + } + final String apiVersion = "2019-01-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.list(this.client.getEndpoint(), apiVersion, scope, assessmentName, accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get security sub-assessments on all your scanned resources inside a scope. + * + * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @param assessmentName The Assessment Key - Unique key for the assessment type. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return security sub-assessments on all your scanned resources inside a scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String scope, String assessmentName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (assessmentName == null) { + return Mono.error(new IllegalArgumentException("Parameter assessmentName is required and cannot be null.")); + } + final String apiVersion = "2019-01-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), apiVersion, scope, assessmentName, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get security sub-assessments on all your scanned resources inside a scope. + * + * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @param assessmentName The Assessment Key - Unique key for the assessment type. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return security sub-assessments on all your scanned resources inside a scope. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String scope, String assessmentName) { + return new PagedFlux<>( + () -> listSinglePageAsync(scope, assessmentName), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Get security sub-assessments on all your scanned resources inside a scope. + * + * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @param assessmentName The Assessment Key - Unique key for the assessment type. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return security sub-assessments on all your scanned resources inside a scope. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String scope, String assessmentName, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(scope, assessmentName, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Get security sub-assessments on all your scanned resources inside a scope. + * + * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @param assessmentName The Assessment Key - Unique key for the assessment type. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return security sub-assessments on all your scanned resources inside a scope. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String scope, String assessmentName) { + return new PagedIterable<>(listAsync(scope, assessmentName)); + } + + /** + * Get security sub-assessments on all your scanned resources inside a scope. + * + * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @param assessmentName The Assessment Key - Unique key for the assessment type. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return security sub-assessments on all your scanned resources inside a scope. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String scope, String assessmentName, Context context) { + return new PagedIterable<>(listAsync(scope, assessmentName, context)); + } + + /** + * Get a security sub-assessment on your scanned resource. + * + * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @param assessmentName The Assessment Key - Unique key for the assessment type. + * @param subAssessmentName The Sub-Assessment Key - Unique key for the sub-assessment type. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a security sub-assessment on your scanned resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String scope, String assessmentName, String subAssessmentName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (assessmentName == null) { + return Mono.error(new IllegalArgumentException("Parameter assessmentName is required and cannot be null.")); + } + if (subAssessmentName == null) { + return Mono + .error(new IllegalArgumentException("Parameter subAssessmentName is required and cannot be null.")); + } + final String apiVersion = "2019-01-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + apiVersion, + scope, + assessmentName, + subAssessmentName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a security sub-assessment on your scanned resource. + * + * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @param assessmentName The Assessment Key - Unique key for the assessment type. + * @param subAssessmentName The Sub-Assessment Key - Unique key for the sub-assessment type. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a security sub-assessment on your scanned resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String scope, String assessmentName, String subAssessmentName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (assessmentName == null) { + return Mono.error(new IllegalArgumentException("Parameter assessmentName is required and cannot be null.")); + } + if (subAssessmentName == null) { + return Mono + .error(new IllegalArgumentException("Parameter subAssessmentName is required and cannot be null.")); + } + final String apiVersion = "2019-01-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get(this.client.getEndpoint(), apiVersion, scope, assessmentName, subAssessmentName, accept, context); + } + + /** + * Get a security sub-assessment on your scanned resource. + * + * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @param assessmentName The Assessment Key - Unique key for the assessment type. + * @param subAssessmentName The Sub-Assessment Key - Unique key for the sub-assessment type. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a security sub-assessment on your scanned resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String scope, String assessmentName, String subAssessmentName) { + return getWithResponseAsync(scope, assessmentName, subAssessmentName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get a security sub-assessment on your scanned resource. + * + * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @param assessmentName The Assessment Key - Unique key for the assessment type. + * @param subAssessmentName The Sub-Assessment Key - Unique key for the sub-assessment type. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a security sub-assessment on your scanned resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SecuritySubAssessmentInner get(String scope, String assessmentName, String subAssessmentName) { + return getAsync(scope, assessmentName, subAssessmentName).block(); + } + + /** + * Get a security sub-assessment on your scanned resource. + * + * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @param assessmentName The Assessment Key - Unique key for the assessment type. + * @param subAssessmentName The Sub-Assessment Key - Unique key for the sub-assessment type. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a security sub-assessment on your scanned resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String scope, String assessmentName, String subAssessmentName, Context context) { + return getWithResponseAsync(scope, assessmentName, subAssessmentName, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security sub-assessments. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAllNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listAllNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security sub-assessments. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAllNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listAllNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security sub-assessments. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security sub-assessments. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SubAssessmentsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SubAssessmentsImpl.java new file mode 100644 index 000000000000..523352770bfe --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SubAssessmentsImpl.java @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.SubAssessmentsClient; +import com.azure.resourcemanager.security.fluent.models.SecuritySubAssessmentInner; +import com.azure.resourcemanager.security.models.SecuritySubAssessment; +import com.azure.resourcemanager.security.models.SubAssessments; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class SubAssessmentsImpl implements SubAssessments { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SubAssessmentsImpl.class); + + private final SubAssessmentsClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public SubAssessmentsImpl( + SubAssessmentsClient innerClient, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listAll(String scope) { + PagedIterable inner = this.serviceClient().listAll(scope); + return Utils.mapPage(inner, inner1 -> new SecuritySubAssessmentImpl(inner1, this.manager())); + } + + public PagedIterable listAll(String scope, Context context) { + PagedIterable inner = this.serviceClient().listAll(scope, context); + return Utils.mapPage(inner, inner1 -> new SecuritySubAssessmentImpl(inner1, this.manager())); + } + + public PagedIterable list(String scope, String assessmentName) { + PagedIterable inner = this.serviceClient().list(scope, assessmentName); + return Utils.mapPage(inner, inner1 -> new SecuritySubAssessmentImpl(inner1, this.manager())); + } + + public PagedIterable list(String scope, String assessmentName, Context context) { + PagedIterable inner = this.serviceClient().list(scope, assessmentName, context); + return Utils.mapPage(inner, inner1 -> new SecuritySubAssessmentImpl(inner1, this.manager())); + } + + public SecuritySubAssessment get(String scope, String assessmentName, String subAssessmentName) { + SecuritySubAssessmentInner inner = this.serviceClient().get(scope, assessmentName, subAssessmentName); + if (inner != null) { + return new SecuritySubAssessmentImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String scope, String assessmentName, String subAssessmentName, Context context) { + Response inner = + this.serviceClient().getWithResponse(scope, assessmentName, subAssessmentName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new SecuritySubAssessmentImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private SubAssessmentsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/TasksClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/TasksClientImpl.java new file mode 100644 index 000000000000..0d5c9662a70d --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/TasksClientImpl.java @@ -0,0 +1,1676 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.TasksClient; +import com.azure.resourcemanager.security.fluent.models.SecurityTaskInner; +import com.azure.resourcemanager.security.models.SecurityTaskList; +import com.azure.resourcemanager.security.models.TasksTaskUpdateActionType; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in TasksClient. */ +public final class TasksClientImpl implements TasksClient { + private final ClientLogger logger = new ClientLogger(TasksClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final TasksService service; + + /** The service client containing this operation class. */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of TasksClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + TasksClientImpl(SecurityCenterImpl client) { + this.service = RestProxy.create(TasksService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterTasks to be used by the proxy service to perform REST + * calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityCenterTasks") + private interface TasksService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/tasks") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("$filter") String filter, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/tasks") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByHomeRegion( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("ascLocation") String ascLocation, + @QueryParam("$filter") String filter, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/tasks/{taskName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getSubscriptionLevelTask( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("ascLocation") String ascLocation, + @PathParam("taskName") String taskName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/tasks/{taskName}" + + "/{taskUpdateActionType}") + @ExpectedResponses({204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> updateSubscriptionLevelTaskState( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("ascLocation") String ascLocation, + @PathParam("taskName") String taskName, + @PathParam("taskUpdateActionType") TasksTaskUpdateActionType taskUpdateActionType, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations" + + "/{ascLocation}/tasks") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("ascLocation") String ascLocation, + @QueryParam("$filter") String filter, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations" + + "/{ascLocation}/tasks/{taskName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getResourceGroupLevelTask( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("ascLocation") String ascLocation, + @PathParam("taskName") String taskName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations" + + "/{ascLocation}/tasks/{taskName}/{taskUpdateActionType}") + @ExpectedResponses({204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> updateResourceGroupLevelTaskState( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("ascLocation") String ascLocation, + @PathParam("taskName") String taskName, + @PathParam("taskUpdateActionType") TasksTaskUpdateActionType taskUpdateActionType, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByHomeRegionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param filter OData filter. Optional. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security task recommendations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String filter) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2015-06-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + filter, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param filter OData filter. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security task recommendations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String filter, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2015-06-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), filter, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param filter OData filter. Optional. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security task recommendations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String filter) { + return new PagedFlux<>(() -> listSinglePageAsync(filter), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security task recommendations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + final String filter = null; + return new PagedFlux<>(() -> listSinglePageAsync(filter), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param filter OData filter. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security task recommendations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String filter, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(filter, context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security task recommendations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + final String filter = null; + return new PagedIterable<>(listAsync(filter)); + } + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param filter OData filter. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security task recommendations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String filter, Context context) { + return new PagedIterable<>(listAsync(filter, context)); + } + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param filter OData filter. Optional. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security task recommendations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByHomeRegionSinglePageAsync(String ascLocation, String filter) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (ascLocation == null) { + return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + final String apiVersion = "2015-06-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByHomeRegion( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + ascLocation, + filter, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param filter OData filter. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security task recommendations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByHomeRegionSinglePageAsync( + String ascLocation, String filter, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (ascLocation == null) { + return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + final String apiVersion = "2015-06-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByHomeRegion( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + ascLocation, + filter, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param filter OData filter. Optional. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security task recommendations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByHomeRegionAsync(String ascLocation, String filter) { + return new PagedFlux<>( + () -> listByHomeRegionSinglePageAsync(ascLocation, filter), + nextLink -> listByHomeRegionNextSinglePageAsync(nextLink)); + } + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security task recommendations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByHomeRegionAsync(String ascLocation) { + final String filter = null; + return new PagedFlux<>( + () -> listByHomeRegionSinglePageAsync(ascLocation, filter), + nextLink -> listByHomeRegionNextSinglePageAsync(nextLink)); + } + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param filter OData filter. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security task recommendations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByHomeRegionAsync(String ascLocation, String filter, Context context) { + return new PagedFlux<>( + () -> listByHomeRegionSinglePageAsync(ascLocation, filter, context), + nextLink -> listByHomeRegionNextSinglePageAsync(nextLink, context)); + } + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security task recommendations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByHomeRegion(String ascLocation) { + final String filter = null; + return new PagedIterable<>(listByHomeRegionAsync(ascLocation, filter)); + } + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param filter OData filter. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security task recommendations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByHomeRegion(String ascLocation, String filter, Context context) { + return new PagedIterable<>(listByHomeRegionAsync(ascLocation, filter, context)); + } + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param taskName Name of the task object, will be a GUID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return security task that we recommend to do in order to strengthen security. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getSubscriptionLevelTaskWithResponseAsync( + String ascLocation, String taskName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (ascLocation == null) { + return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + if (taskName == null) { + return Mono.error(new IllegalArgumentException("Parameter taskName is required and cannot be null.")); + } + final String apiVersion = "2015-06-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getSubscriptionLevelTask( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + ascLocation, + taskName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param taskName Name of the task object, will be a GUID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return security task that we recommend to do in order to strengthen security. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getSubscriptionLevelTaskWithResponseAsync( + String ascLocation, String taskName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (ascLocation == null) { + return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + if (taskName == null) { + return Mono.error(new IllegalArgumentException("Parameter taskName is required and cannot be null.")); + } + final String apiVersion = "2015-06-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getSubscriptionLevelTask( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + ascLocation, + taskName, + accept, + context); + } + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param taskName Name of the task object, will be a GUID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return security task that we recommend to do in order to strengthen security. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getSubscriptionLevelTaskAsync(String ascLocation, String taskName) { + return getSubscriptionLevelTaskWithResponseAsync(ascLocation, taskName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param taskName Name of the task object, will be a GUID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return security task that we recommend to do in order to strengthen security. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SecurityTaskInner getSubscriptionLevelTask(String ascLocation, String taskName) { + return getSubscriptionLevelTaskAsync(ascLocation, taskName).block(); + } + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param taskName Name of the task object, will be a GUID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return security task that we recommend to do in order to strengthen security. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getSubscriptionLevelTaskWithResponse( + String ascLocation, String taskName, Context context) { + return getSubscriptionLevelTaskWithResponseAsync(ascLocation, taskName, context).block(); + } + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param taskName Name of the task object, will be a GUID. + * @param taskUpdateActionType Type of the action to do on the task. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateSubscriptionLevelTaskStateWithResponseAsync( + String ascLocation, String taskName, TasksTaskUpdateActionType taskUpdateActionType) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (ascLocation == null) { + return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + if (taskName == null) { + return Mono.error(new IllegalArgumentException("Parameter taskName is required and cannot be null.")); + } + if (taskUpdateActionType == null) { + return Mono + .error(new IllegalArgumentException("Parameter taskUpdateActionType is required and cannot be null.")); + } + final String apiVersion = "2015-06-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .updateSubscriptionLevelTaskState( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + ascLocation, + taskName, + taskUpdateActionType, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param taskName Name of the task object, will be a GUID. + * @param taskUpdateActionType Type of the action to do on the task. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateSubscriptionLevelTaskStateWithResponseAsync( + String ascLocation, String taskName, TasksTaskUpdateActionType taskUpdateActionType, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (ascLocation == null) { + return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + if (taskName == null) { + return Mono.error(new IllegalArgumentException("Parameter taskName is required and cannot be null.")); + } + if (taskUpdateActionType == null) { + return Mono + .error(new IllegalArgumentException("Parameter taskUpdateActionType is required and cannot be null.")); + } + final String apiVersion = "2015-06-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .updateSubscriptionLevelTaskState( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + ascLocation, + taskName, + taskUpdateActionType, + accept, + context); + } + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param taskName Name of the task object, will be a GUID. + * @param taskUpdateActionType Type of the action to do on the task. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateSubscriptionLevelTaskStateAsync( + String ascLocation, String taskName, TasksTaskUpdateActionType taskUpdateActionType) { + return updateSubscriptionLevelTaskStateWithResponseAsync(ascLocation, taskName, taskUpdateActionType) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param taskName Name of the task object, will be a GUID. + * @param taskUpdateActionType Type of the action to do on the task. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void updateSubscriptionLevelTaskState( + String ascLocation, String taskName, TasksTaskUpdateActionType taskUpdateActionType) { + updateSubscriptionLevelTaskStateAsync(ascLocation, taskName, taskUpdateActionType).block(); + } + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param taskName Name of the task object, will be a GUID. + * @param taskUpdateActionType Type of the action to do on the task. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateSubscriptionLevelTaskStateWithResponse( + String ascLocation, String taskName, TasksTaskUpdateActionType taskUpdateActionType, Context context) { + return updateSubscriptionLevelTaskStateWithResponseAsync(ascLocation, taskName, taskUpdateActionType, context) + .block(); + } + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param filter OData filter. Optional. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security task recommendations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, String ascLocation, String filter) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (ascLocation == null) { + return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + final String apiVersion = "2015-06-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + ascLocation, + filter, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param filter OData filter. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security task recommendations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, String ascLocation, String filter, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (ascLocation == null) { + return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + final String apiVersion = "2015-06-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + ascLocation, + filter, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param filter OData filter. Optional. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security task recommendations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync( + String resourceGroupName, String ascLocation, String filter) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, ascLocation, filter), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security task recommendations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, String ascLocation) { + final String filter = null; + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, ascLocation, filter), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param filter OData filter. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security task recommendations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync( + String resourceGroupName, String ascLocation, String filter, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, ascLocation, filter, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security task recommendations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, String ascLocation) { + final String filter = null; + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, ascLocation, filter)); + } + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param filter OData filter. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security task recommendations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup( + String resourceGroupName, String ascLocation, String filter, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, ascLocation, filter, context)); + } + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param taskName Name of the task object, will be a GUID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return security task that we recommend to do in order to strengthen security. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getResourceGroupLevelTaskWithResponseAsync( + String resourceGroupName, String ascLocation, String taskName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (ascLocation == null) { + return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + if (taskName == null) { + return Mono.error(new IllegalArgumentException("Parameter taskName is required and cannot be null.")); + } + final String apiVersion = "2015-06-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getResourceGroupLevelTask( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + ascLocation, + taskName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param taskName Name of the task object, will be a GUID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return security task that we recommend to do in order to strengthen security. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getResourceGroupLevelTaskWithResponseAsync( + String resourceGroupName, String ascLocation, String taskName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (ascLocation == null) { + return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + if (taskName == null) { + return Mono.error(new IllegalArgumentException("Parameter taskName is required and cannot be null.")); + } + final String apiVersion = "2015-06-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getResourceGroupLevelTask( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + ascLocation, + taskName, + accept, + context); + } + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param taskName Name of the task object, will be a GUID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return security task that we recommend to do in order to strengthen security. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getResourceGroupLevelTaskAsync( + String resourceGroupName, String ascLocation, String taskName) { + return getResourceGroupLevelTaskWithResponseAsync(resourceGroupName, ascLocation, taskName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param taskName Name of the task object, will be a GUID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return security task that we recommend to do in order to strengthen security. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SecurityTaskInner getResourceGroupLevelTask(String resourceGroupName, String ascLocation, String taskName) { + return getResourceGroupLevelTaskAsync(resourceGroupName, ascLocation, taskName).block(); + } + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param taskName Name of the task object, will be a GUID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return security task that we recommend to do in order to strengthen security. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getResourceGroupLevelTaskWithResponse( + String resourceGroupName, String ascLocation, String taskName, Context context) { + return getResourceGroupLevelTaskWithResponseAsync(resourceGroupName, ascLocation, taskName, context).block(); + } + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param taskName Name of the task object, will be a GUID. + * @param taskUpdateActionType Type of the action to do on the task. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateResourceGroupLevelTaskStateWithResponseAsync( + String resourceGroupName, String ascLocation, String taskName, TasksTaskUpdateActionType taskUpdateActionType) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (ascLocation == null) { + return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + if (taskName == null) { + return Mono.error(new IllegalArgumentException("Parameter taskName is required and cannot be null.")); + } + if (taskUpdateActionType == null) { + return Mono + .error(new IllegalArgumentException("Parameter taskUpdateActionType is required and cannot be null.")); + } + final String apiVersion = "2015-06-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .updateResourceGroupLevelTaskState( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + ascLocation, + taskName, + taskUpdateActionType, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param taskName Name of the task object, will be a GUID. + * @param taskUpdateActionType Type of the action to do on the task. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateResourceGroupLevelTaskStateWithResponseAsync( + String resourceGroupName, + String ascLocation, + String taskName, + TasksTaskUpdateActionType taskUpdateActionType, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (ascLocation == null) { + return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + if (taskName == null) { + return Mono.error(new IllegalArgumentException("Parameter taskName is required and cannot be null.")); + } + if (taskUpdateActionType == null) { + return Mono + .error(new IllegalArgumentException("Parameter taskUpdateActionType is required and cannot be null.")); + } + final String apiVersion = "2015-06-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .updateResourceGroupLevelTaskState( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + ascLocation, + taskName, + taskUpdateActionType, + accept, + context); + } + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param taskName Name of the task object, will be a GUID. + * @param taskUpdateActionType Type of the action to do on the task. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateResourceGroupLevelTaskStateAsync( + String resourceGroupName, String ascLocation, String taskName, TasksTaskUpdateActionType taskUpdateActionType) { + return updateResourceGroupLevelTaskStateWithResponseAsync( + resourceGroupName, ascLocation, taskName, taskUpdateActionType) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param taskName Name of the task object, will be a GUID. + * @param taskUpdateActionType Type of the action to do on the task. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void updateResourceGroupLevelTaskState( + String resourceGroupName, String ascLocation, String taskName, TasksTaskUpdateActionType taskUpdateActionType) { + updateResourceGroupLevelTaskStateAsync(resourceGroupName, ascLocation, taskName, taskUpdateActionType).block(); + } + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param taskName Name of the task object, will be a GUID. + * @param taskUpdateActionType Type of the action to do on the task. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateResourceGroupLevelTaskStateWithResponse( + String resourceGroupName, + String ascLocation, + String taskName, + TasksTaskUpdateActionType taskUpdateActionType, + Context context) { + return updateResourceGroupLevelTaskStateWithResponseAsync( + resourceGroupName, ascLocation, taskName, taskUpdateActionType, context) + .block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security task recommendations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security task recommendations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security task recommendations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByHomeRegionNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByHomeRegionNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security task recommendations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByHomeRegionNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByHomeRegionNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security task recommendations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security task recommendations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/TasksImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/TasksImpl.java new file mode 100644 index 000000000000..56f113942bbd --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/TasksImpl.java @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.TasksClient; +import com.azure.resourcemanager.security.fluent.models.SecurityTaskInner; +import com.azure.resourcemanager.security.models.SecurityTask; +import com.azure.resourcemanager.security.models.Tasks; +import com.azure.resourcemanager.security.models.TasksTaskUpdateActionType; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class TasksImpl implements Tasks { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TasksImpl.class); + + private final TasksClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public TasksImpl(TasksClient innerClient, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new SecurityTaskImpl(inner1, this.manager())); + } + + public PagedIterable list(String filter, Context context) { + PagedIterable inner = this.serviceClient().list(filter, context); + return Utils.mapPage(inner, inner1 -> new SecurityTaskImpl(inner1, this.manager())); + } + + public PagedIterable listByHomeRegion(String ascLocation) { + PagedIterable inner = this.serviceClient().listByHomeRegion(ascLocation); + return Utils.mapPage(inner, inner1 -> new SecurityTaskImpl(inner1, this.manager())); + } + + public PagedIterable listByHomeRegion(String ascLocation, String filter, Context context) { + PagedIterable inner = this.serviceClient().listByHomeRegion(ascLocation, filter, context); + return Utils.mapPage(inner, inner1 -> new SecurityTaskImpl(inner1, this.manager())); + } + + public SecurityTask getSubscriptionLevelTask(String ascLocation, String taskName) { + SecurityTaskInner inner = this.serviceClient().getSubscriptionLevelTask(ascLocation, taskName); + if (inner != null) { + return new SecurityTaskImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getSubscriptionLevelTaskWithResponse( + String ascLocation, String taskName, Context context) { + Response inner = + this.serviceClient().getSubscriptionLevelTaskWithResponse(ascLocation, taskName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new SecurityTaskImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void updateSubscriptionLevelTaskState( + String ascLocation, String taskName, TasksTaskUpdateActionType taskUpdateActionType) { + this.serviceClient().updateSubscriptionLevelTaskState(ascLocation, taskName, taskUpdateActionType); + } + + public Response updateSubscriptionLevelTaskStateWithResponse( + String ascLocation, String taskName, TasksTaskUpdateActionType taskUpdateActionType, Context context) { + return this + .serviceClient() + .updateSubscriptionLevelTaskStateWithResponse(ascLocation, taskName, taskUpdateActionType, context); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, String ascLocation) { + PagedIterable inner = + this.serviceClient().listByResourceGroup(resourceGroupName, ascLocation); + return Utils.mapPage(inner, inner1 -> new SecurityTaskImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup( + String resourceGroupName, String ascLocation, String filter, Context context) { + PagedIterable inner = + this.serviceClient().listByResourceGroup(resourceGroupName, ascLocation, filter, context); + return Utils.mapPage(inner, inner1 -> new SecurityTaskImpl(inner1, this.manager())); + } + + public SecurityTask getResourceGroupLevelTask(String resourceGroupName, String ascLocation, String taskName) { + SecurityTaskInner inner = + this.serviceClient().getResourceGroupLevelTask(resourceGroupName, ascLocation, taskName); + if (inner != null) { + return new SecurityTaskImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getResourceGroupLevelTaskWithResponse( + String resourceGroupName, String ascLocation, String taskName, Context context) { + Response inner = + this + .serviceClient() + .getResourceGroupLevelTaskWithResponse(resourceGroupName, ascLocation, taskName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new SecurityTaskImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void updateResourceGroupLevelTaskState( + String resourceGroupName, String ascLocation, String taskName, TasksTaskUpdateActionType taskUpdateActionType) { + this + .serviceClient() + .updateResourceGroupLevelTaskState(resourceGroupName, ascLocation, taskName, taskUpdateActionType); + } + + public Response updateResourceGroupLevelTaskStateWithResponse( + String resourceGroupName, + String ascLocation, + String taskName, + TasksTaskUpdateActionType taskUpdateActionType, + Context context) { + return this + .serviceClient() + .updateResourceGroupLevelTaskStateWithResponse( + resourceGroupName, ascLocation, taskName, taskUpdateActionType, context); + } + + private TasksClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/TopologiesClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/TopologiesClientImpl.java new file mode 100644 index 000000000000..5a53426b54f6 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/TopologiesClientImpl.java @@ -0,0 +1,737 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.TopologiesClient; +import com.azure.resourcemanager.security.fluent.models.TopologyResourceInner; +import com.azure.resourcemanager.security.models.TopologyList; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in TopologiesClient. */ +public final class TopologiesClientImpl implements TopologiesClient { + private final ClientLogger logger = new ClientLogger(TopologiesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final TopologiesService service; + + /** The service client containing this operation class. */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of TopologiesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + TopologiesClientImpl(SecurityCenterImpl client) { + this.service = + RestProxy.create(TopologiesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterTopologies to be used by the proxy service to perform + * REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityCenterTopolo") + private interface TopologiesService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/topologies") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/topologies") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByHomeRegion( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("ascLocation") String ascLocation, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations" + + "/{ascLocation}/topologies/{topologyResourceName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("ascLocation") String ascLocation, + @PathParam("topologyResourceName") String topologyResourceName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByHomeRegionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a list that allows to build a topology view of a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list that allows to build a topology view of a subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list(this.client.getEndpoint(), this.client.getSubscriptionId(), apiVersion, accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list that allows to build a topology view of a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list that allows to build a topology view of a subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getSubscriptionId(), apiVersion, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a list that allows to build a topology view of a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list that allows to build a topology view of a subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list that allows to build a topology view of a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list that allows to build a topology view of a subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list that allows to build a topology view of a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list that allows to build a topology view of a subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Gets a list that allows to build a topology view of a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list that allows to build a topology view of a subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Gets a list that allows to build a topology view of a subscription and location. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list that allows to build a topology view of a subscription and location. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByHomeRegionSinglePageAsync(String ascLocation) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (ascLocation == null) { + return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByHomeRegion( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + ascLocation, + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list that allows to build a topology view of a subscription and location. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list that allows to build a topology view of a subscription and location. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByHomeRegionSinglePageAsync( + String ascLocation, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (ascLocation == null) { + return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByHomeRegion( + this.client.getEndpoint(), this.client.getSubscriptionId(), ascLocation, apiVersion, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a list that allows to build a topology view of a subscription and location. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list that allows to build a topology view of a subscription and location. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByHomeRegionAsync(String ascLocation) { + return new PagedFlux<>( + () -> listByHomeRegionSinglePageAsync(ascLocation), + nextLink -> listByHomeRegionNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list that allows to build a topology view of a subscription and location. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list that allows to build a topology view of a subscription and location. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByHomeRegionAsync(String ascLocation, Context context) { + return new PagedFlux<>( + () -> listByHomeRegionSinglePageAsync(ascLocation, context), + nextLink -> listByHomeRegionNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list that allows to build a topology view of a subscription and location. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list that allows to build a topology view of a subscription and location. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByHomeRegion(String ascLocation) { + return new PagedIterable<>(listByHomeRegionAsync(ascLocation)); + } + + /** + * Gets a list that allows to build a topology view of a subscription and location. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list that allows to build a topology view of a subscription and location. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByHomeRegion(String ascLocation, Context context) { + return new PagedIterable<>(listByHomeRegionAsync(ascLocation, context)); + } + + /** + * Gets a specific topology component. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param topologyResourceName Name of a topology resources collection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a specific topology component. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String ascLocation, String topologyResourceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (ascLocation == null) { + return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + if (topologyResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter topologyResourceName is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + ascLocation, + topologyResourceName, + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a specific topology component. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param topologyResourceName Name of a topology resources collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a specific topology component. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String ascLocation, String topologyResourceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (ascLocation == null) { + return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + if (topologyResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter topologyResourceName is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + ascLocation, + topologyResourceName, + apiVersion, + accept, + context); + } + + /** + * Gets a specific topology component. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param topologyResourceName Name of a topology resources collection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a specific topology component. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String ascLocation, String topologyResourceName) { + return getWithResponseAsync(resourceGroupName, ascLocation, topologyResourceName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a specific topology component. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param topologyResourceName Name of a topology resources collection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a specific topology component. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public TopologyResourceInner get(String resourceGroupName, String ascLocation, String topologyResourceName) { + return getAsync(resourceGroupName, ascLocation, topologyResourceName).block(); + } + + /** + * Gets a specific topology component. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param topologyResourceName Name of a topology resources collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a specific topology component. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String ascLocation, String topologyResourceName, Context context) { + return getWithResponseAsync(resourceGroupName, ascLocation, topologyResourceName, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByHomeRegionNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByHomeRegionNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByHomeRegionNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByHomeRegionNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/TopologiesImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/TopologiesImpl.java new file mode 100644 index 000000000000..1d8425660d5b --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/TopologiesImpl.java @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.TopologiesClient; +import com.azure.resourcemanager.security.fluent.models.TopologyResourceInner; +import com.azure.resourcemanager.security.models.Topologies; +import com.azure.resourcemanager.security.models.TopologyResource; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class TopologiesImpl implements Topologies { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TopologiesImpl.class); + + private final TopologiesClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public TopologiesImpl( + TopologiesClient innerClient, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new TopologyResourceImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new TopologyResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByHomeRegion(String ascLocation) { + PagedIterable inner = this.serviceClient().listByHomeRegion(ascLocation); + return Utils.mapPage(inner, inner1 -> new TopologyResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByHomeRegion(String ascLocation, Context context) { + PagedIterable inner = this.serviceClient().listByHomeRegion(ascLocation, context); + return Utils.mapPage(inner, inner1 -> new TopologyResourceImpl(inner1, this.manager())); + } + + public TopologyResource get(String resourceGroupName, String ascLocation, String topologyResourceName) { + TopologyResourceInner inner = this.serviceClient().get(resourceGroupName, ascLocation, topologyResourceName); + if (inner != null) { + return new TopologyResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String ascLocation, String topologyResourceName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, ascLocation, topologyResourceName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new TopologyResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private TopologiesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/TopologyResourceImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/TopologyResourceImpl.java new file mode 100644 index 000000000000..e3a7eac73512 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/TopologyResourceImpl.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.resourcemanager.security.fluent.models.TopologyResourceInner; +import com.azure.resourcemanager.security.models.TopologyResource; +import com.azure.resourcemanager.security.models.TopologySingleResource; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; + +public final class TopologyResourceImpl implements TopologyResource { + private TopologyResourceInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + TopologyResourceImpl( + TopologyResourceInner innerObject, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public OffsetDateTime calculatedDateTime() { + return this.innerModel().calculatedDateTime(); + } + + public List topologyResources() { + List inner = this.innerModel().topologyResources(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public String location() { + return this.innerModel().location(); + } + + public TopologyResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/Utils.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/Utils.java new file mode 100644 index 000000000000..210bf291fe60 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/Utils.java @@ -0,0 +1,204 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.util.CoreUtils; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.function.Function; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import reactor.core.publisher.Flux; + +final class Utils { + static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterator itr = Arrays.stream(id.split("/")).iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && !part.trim().isEmpty()) { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + static String getValueFromIdByParameterName(String id, String pathTemplate, String parameterName) { + if (id == null || pathTemplate == null) { + return null; + } + String parameterNameParentheses = "{" + parameterName + "}"; + List idSegmentsReverted = Arrays.asList(id.split("/")); + List pathSegments = Arrays.asList(pathTemplate.split("/")); + Collections.reverse(idSegmentsReverted); + Iterator idItrReverted = idSegmentsReverted.iterator(); + int pathIndex = pathSegments.size(); + while (idItrReverted.hasNext() && pathIndex > 0) { + String idSegment = idItrReverted.next(); + String pathSegment = pathSegments.get(--pathIndex); + if (!CoreUtils.isNullOrEmpty(idSegment) && !CoreUtils.isNullOrEmpty(pathSegment)) { + if (pathSegment.equalsIgnoreCase(parameterNameParentheses)) { + if (pathIndex == 0 || (pathIndex == 1 && pathSegments.get(0).isEmpty())) { + List segments = new ArrayList<>(); + segments.add(idSegment); + idItrReverted.forEachRemaining(segments::add); + Collections.reverse(segments); + if (segments.size() > 0 && segments.get(0).isEmpty()) { + segments.remove(0); + } + return String.join("/", segments); + } else { + return idSegment; + } + } + } + } + return null; + } + + static PagedIterable mapPage(PagedIterable pageIterable, Function mapper) { + return new PagedIterableImpl(pageIterable, mapper); + } + + private static final class PagedIterableImpl extends PagedIterable { + + private final PagedIterable pagedIterable; + private final Function mapper; + private final Function, PagedResponse> pageMapper; + + private PagedIterableImpl(PagedIterable pagedIterable, Function mapper) { + super( + PagedFlux + .create( + () -> + (continuationToken, pageSize) -> + Flux.fromStream(pagedIterable.streamByPage().map(getPageMapper(mapper))))); + this.pagedIterable = pagedIterable; + this.mapper = mapper; + this.pageMapper = getPageMapper(mapper); + } + + private static Function, PagedResponse> getPageMapper(Function mapper) { + return page -> + new PagedResponseBase( + page.getRequest(), + page.getStatusCode(), + page.getHeaders(), + page.getElements().stream().map(mapper).collect(Collectors.toList()), + page.getContinuationToken(), + null); + } + + @Override + public Stream stream() { + return pagedIterable.stream().map(mapper); + } + + @Override + public Stream> streamByPage() { + return pagedIterable.streamByPage().map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken) { + return pagedIterable.streamByPage(continuationToken).map(pageMapper); + } + + @Override + public Stream> streamByPage(int preferredPageSize) { + return pagedIterable.streamByPage(preferredPageSize).map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken, int preferredPageSize) { + return pagedIterable.streamByPage(continuationToken, preferredPageSize).map(pageMapper); + } + + @Override + public Iterator iterator() { + return new IteratorImpl(pagedIterable.iterator(), mapper); + } + + @Override + public Iterable> iterableByPage() { + return new IterableImpl, PagedResponse>(pagedIterable.iterableByPage(), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(continuationToken), pageMapper); + } + + @Override + public Iterable> iterableByPage(int preferredPageSize) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(preferredPageSize), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken, int preferredPageSize) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(continuationToken, preferredPageSize), pageMapper); + } + } + + private static final class IteratorImpl implements Iterator { + + private final Iterator iterator; + private final Function mapper; + + private IteratorImpl(Iterator iterator, Function mapper) { + this.iterator = iterator; + this.mapper = mapper; + } + + @Override + public boolean hasNext() { + return iterator.hasNext(); + } + + @Override + public S next() { + return mapper.apply(iterator.next()); + } + + @Override + public void remove() { + iterator.remove(); + } + } + + private static final class IterableImpl implements Iterable { + + private final Iterable iterable; + private final Function mapper; + + private IterableImpl(Iterable iterable, Function mapper) { + this.iterable = iterable; + this.mapper = mapper; + } + + @Override + public Iterator iterator() { + return new IteratorImpl(iterable.iterator(), mapper); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/WorkspaceSettingImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/WorkspaceSettingImpl.java new file mode 100644 index 000000000000..2fdd469eb260 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/WorkspaceSettingImpl.java @@ -0,0 +1,133 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.WorkspaceSettingInner; +import com.azure.resourcemanager.security.models.WorkspaceSetting; + +public final class WorkspaceSettingImpl + implements WorkspaceSetting, WorkspaceSetting.Definition, WorkspaceSetting.Update { + private WorkspaceSettingInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String workspaceId() { + return this.innerModel().workspaceId(); + } + + public String scope() { + return this.innerModel().scope(); + } + + public WorkspaceSettingInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } + + private String workspaceSettingName; + + public WorkspaceSetting create() { + this.innerObject = + serviceManager + .serviceClient() + .getWorkspaceSettings() + .createWithResponse(workspaceSettingName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public WorkspaceSetting create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getWorkspaceSettings() + .createWithResponse(workspaceSettingName, this.innerModel(), context) + .getValue(); + return this; + } + + WorkspaceSettingImpl(String name, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = new WorkspaceSettingInner(); + this.serviceManager = serviceManager; + this.workspaceSettingName = name; + } + + public WorkspaceSettingImpl update() { + return this; + } + + public WorkspaceSetting apply() { + this.innerObject = + serviceManager + .serviceClient() + .getWorkspaceSettings() + .updateWithResponse(workspaceSettingName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public WorkspaceSetting apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getWorkspaceSettings() + .updateWithResponse(workspaceSettingName, this.innerModel(), context) + .getValue(); + return this; + } + + WorkspaceSettingImpl( + WorkspaceSettingInner innerObject, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.workspaceSettingName = Utils.getValueFromIdByName(innerObject.id(), "workspaceSettings"); + } + + public WorkspaceSetting refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getWorkspaceSettings() + .getWithResponse(workspaceSettingName, Context.NONE) + .getValue(); + return this; + } + + public WorkspaceSetting refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getWorkspaceSettings() + .getWithResponse(workspaceSettingName, context) + .getValue(); + return this; + } + + public WorkspaceSettingImpl withWorkspaceId(String workspaceId) { + this.innerModel().withWorkspaceId(workspaceId); + return this; + } + + public WorkspaceSettingImpl withScope(String scope) { + this.innerModel().withScope(scope); + return this; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/WorkspaceSettingsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/WorkspaceSettingsClientImpl.java new file mode 100644 index 000000000000..396745050c34 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/WorkspaceSettingsClientImpl.java @@ -0,0 +1,928 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.WorkspaceSettingsClient; +import com.azure.resourcemanager.security.fluent.models.WorkspaceSettingInner; +import com.azure.resourcemanager.security.models.WorkspaceSettingList; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in WorkspaceSettingsClient. */ +public final class WorkspaceSettingsClientImpl implements WorkspaceSettingsClient { + private final ClientLogger logger = new ClientLogger(WorkspaceSettingsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final WorkspaceSettingsService service; + + /** The service client containing this operation class. */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of WorkspaceSettingsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + WorkspaceSettingsClientImpl(SecurityCenterImpl client) { + this.service = + RestProxy.create(WorkspaceSettingsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterWorkspaceSettings to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityCenterWorksp") + private interface WorkspaceSettingsService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/workspaceSettings") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/workspaceSettings/{workspaceSettingName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("workspaceSettingName") String workspaceSettingName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put("/subscriptions/{subscriptionId}/providers/Microsoft.Security/workspaceSettings/{workspaceSettingName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> create( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("workspaceSettingName") String workspaceSettingName, + @BodyParam("application/json") WorkspaceSettingInner workspaceSetting, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch("/subscriptions/{subscriptionId}/providers/Microsoft.Security/workspaceSettings/{workspaceSettingName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("workspaceSettingName") String workspaceSettingName, + @BodyParam("application/json") WorkspaceSettingInner workspaceSetting, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete("/subscriptions/{subscriptionId}/providers/Microsoft.Security/workspaceSettings/{workspaceSettingName}") + @ExpectedResponses({204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("workspaceSettingName") String workspaceSettingName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Settings about where we should store your security data and logs. If the result is empty, it means that no + * custom-workspace configuration was set. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of workspace settings response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-08-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Settings about where we should store your security data and logs. If the result is empty, it means that no + * custom-workspace configuration was set. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of workspace settings response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-08-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Settings about where we should store your security data and logs. If the result is empty, it means that no + * custom-workspace configuration was set. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of workspace settings response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Settings about where we should store your security data and logs. If the result is empty, it means that no + * custom-workspace configuration was set. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of workspace settings response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Settings about where we should store your security data and logs. If the result is empty, it means that no + * custom-workspace configuration was set. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of workspace settings response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Settings about where we should store your security data and logs. If the result is empty, it means that no + * custom-workspace configuration was set. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of workspace settings response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Settings about where we should store your security data and logs. If the result is empty, it means that no + * custom-workspace configuration was set. + * + * @param workspaceSettingName Name of the security setting. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return configures where to store the OMS agent data for workspaces under a scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String workspaceSettingName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (workspaceSettingName == null) { + return Mono + .error(new IllegalArgumentException("Parameter workspaceSettingName is required and cannot be null.")); + } + final String apiVersion = "2017-08-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + workspaceSettingName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Settings about where we should store your security data and logs. If the result is empty, it means that no + * custom-workspace configuration was set. + * + * @param workspaceSettingName Name of the security setting. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return configures where to store the OMS agent data for workspaces under a scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String workspaceSettingName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (workspaceSettingName == null) { + return Mono + .error(new IllegalArgumentException("Parameter workspaceSettingName is required and cannot be null.")); + } + final String apiVersion = "2017-08-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + workspaceSettingName, + accept, + context); + } + + /** + * Settings about where we should store your security data and logs. If the result is empty, it means that no + * custom-workspace configuration was set. + * + * @param workspaceSettingName Name of the security setting. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return configures where to store the OMS agent data for workspaces under a scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String workspaceSettingName) { + return getWithResponseAsync(workspaceSettingName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Settings about where we should store your security data and logs. If the result is empty, it means that no + * custom-workspace configuration was set. + * + * @param workspaceSettingName Name of the security setting. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return configures where to store the OMS agent data for workspaces under a scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public WorkspaceSettingInner get(String workspaceSettingName) { + return getAsync(workspaceSettingName).block(); + } + + /** + * Settings about where we should store your security data and logs. If the result is empty, it means that no + * custom-workspace configuration was set. + * + * @param workspaceSettingName Name of the security setting. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return configures where to store the OMS agent data for workspaces under a scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String workspaceSettingName, Context context) { + return getWithResponseAsync(workspaceSettingName, context).block(); + } + + /** + * creating settings about where we should store your security data and logs. + * + * @param workspaceSettingName Name of the security setting. + * @param workspaceSetting Security data setting object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return configures where to store the OMS agent data for workspaces under a scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync( + String workspaceSettingName, WorkspaceSettingInner workspaceSetting) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (workspaceSettingName == null) { + return Mono + .error(new IllegalArgumentException("Parameter workspaceSettingName is required and cannot be null.")); + } + if (workspaceSetting == null) { + return Mono + .error(new IllegalArgumentException("Parameter workspaceSetting is required and cannot be null.")); + } else { + workspaceSetting.validate(); + } + final String apiVersion = "2017-08-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .create( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + workspaceSettingName, + workspaceSetting, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * creating settings about where we should store your security data and logs. + * + * @param workspaceSettingName Name of the security setting. + * @param workspaceSetting Security data setting object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return configures where to store the OMS agent data for workspaces under a scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync( + String workspaceSettingName, WorkspaceSettingInner workspaceSetting, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (workspaceSettingName == null) { + return Mono + .error(new IllegalArgumentException("Parameter workspaceSettingName is required and cannot be null.")); + } + if (workspaceSetting == null) { + return Mono + .error(new IllegalArgumentException("Parameter workspaceSetting is required and cannot be null.")); + } else { + workspaceSetting.validate(); + } + final String apiVersion = "2017-08-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .create( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + workspaceSettingName, + workspaceSetting, + accept, + context); + } + + /** + * creating settings about where we should store your security data and logs. + * + * @param workspaceSettingName Name of the security setting. + * @param workspaceSetting Security data setting object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return configures where to store the OMS agent data for workspaces under a scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String workspaceSettingName, WorkspaceSettingInner workspaceSetting) { + return createWithResponseAsync(workspaceSettingName, workspaceSetting) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * creating settings about where we should store your security data and logs. + * + * @param workspaceSettingName Name of the security setting. + * @param workspaceSetting Security data setting object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return configures where to store the OMS agent data for workspaces under a scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public WorkspaceSettingInner create(String workspaceSettingName, WorkspaceSettingInner workspaceSetting) { + return createAsync(workspaceSettingName, workspaceSetting).block(); + } + + /** + * creating settings about where we should store your security data and logs. + * + * @param workspaceSettingName Name of the security setting. + * @param workspaceSetting Security data setting object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return configures where to store the OMS agent data for workspaces under a scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createWithResponse( + String workspaceSettingName, WorkspaceSettingInner workspaceSetting, Context context) { + return createWithResponseAsync(workspaceSettingName, workspaceSetting, context).block(); + } + + /** + * Settings about where we should store your security data and logs. + * + * @param workspaceSettingName Name of the security setting. + * @param workspaceSetting Security data setting object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return configures where to store the OMS agent data for workspaces under a scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String workspaceSettingName, WorkspaceSettingInner workspaceSetting) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (workspaceSettingName == null) { + return Mono + .error(new IllegalArgumentException("Parameter workspaceSettingName is required and cannot be null.")); + } + if (workspaceSetting == null) { + return Mono + .error(new IllegalArgumentException("Parameter workspaceSetting is required and cannot be null.")); + } else { + workspaceSetting.validate(); + } + final String apiVersion = "2017-08-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + workspaceSettingName, + workspaceSetting, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Settings about where we should store your security data and logs. + * + * @param workspaceSettingName Name of the security setting. + * @param workspaceSetting Security data setting object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return configures where to store the OMS agent data for workspaces under a scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String workspaceSettingName, WorkspaceSettingInner workspaceSetting, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (workspaceSettingName == null) { + return Mono + .error(new IllegalArgumentException("Parameter workspaceSettingName is required and cannot be null.")); + } + if (workspaceSetting == null) { + return Mono + .error(new IllegalArgumentException("Parameter workspaceSetting is required and cannot be null.")); + } else { + workspaceSetting.validate(); + } + final String apiVersion = "2017-08-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + workspaceSettingName, + workspaceSetting, + accept, + context); + } + + /** + * Settings about where we should store your security data and logs. + * + * @param workspaceSettingName Name of the security setting. + * @param workspaceSetting Security data setting object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return configures where to store the OMS agent data for workspaces under a scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String workspaceSettingName, WorkspaceSettingInner workspaceSetting) { + return updateWithResponseAsync(workspaceSettingName, workspaceSetting) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Settings about where we should store your security data and logs. + * + * @param workspaceSettingName Name of the security setting. + * @param workspaceSetting Security data setting object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return configures where to store the OMS agent data for workspaces under a scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public WorkspaceSettingInner update(String workspaceSettingName, WorkspaceSettingInner workspaceSetting) { + return updateAsync(workspaceSettingName, workspaceSetting).block(); + } + + /** + * Settings about where we should store your security data and logs. + * + * @param workspaceSettingName Name of the security setting. + * @param workspaceSetting Security data setting object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return configures where to store the OMS agent data for workspaces under a scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String workspaceSettingName, WorkspaceSettingInner workspaceSetting, Context context) { + return updateWithResponseAsync(workspaceSettingName, workspaceSetting, context).block(); + } + + /** + * Deletes the custom workspace settings for this subscription. new VMs will report to the default workspace. + * + * @param workspaceSettingName Name of the security setting. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String workspaceSettingName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (workspaceSettingName == null) { + return Mono + .error(new IllegalArgumentException("Parameter workspaceSettingName is required and cannot be null.")); + } + final String apiVersion = "2017-08-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + workspaceSettingName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes the custom workspace settings for this subscription. new VMs will report to the default workspace. + * + * @param workspaceSettingName Name of the security setting. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String workspaceSettingName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (workspaceSettingName == null) { + return Mono + .error(new IllegalArgumentException("Parameter workspaceSettingName is required and cannot be null.")); + } + final String apiVersion = "2017-08-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + workspaceSettingName, + accept, + context); + } + + /** + * Deletes the custom workspace settings for this subscription. new VMs will report to the default workspace. + * + * @param workspaceSettingName Name of the security setting. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String workspaceSettingName) { + return deleteWithResponseAsync(workspaceSettingName).flatMap((Response res) -> Mono.empty()); + } + + /** + * Deletes the custom workspace settings for this subscription. new VMs will report to the default workspace. + * + * @param workspaceSettingName Name of the security setting. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String workspaceSettingName) { + deleteAsync(workspaceSettingName).block(); + } + + /** + * Deletes the custom workspace settings for this subscription. new VMs will report to the default workspace. + * + * @param workspaceSettingName Name of the security setting. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String workspaceSettingName, Context context) { + return deleteWithResponseAsync(workspaceSettingName, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of workspace settings response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of workspace settings response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/WorkspaceSettingsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/WorkspaceSettingsImpl.java new file mode 100644 index 000000000000..1d2acad307d8 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/WorkspaceSettingsImpl.java @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.WorkspaceSettingsClient; +import com.azure.resourcemanager.security.fluent.models.WorkspaceSettingInner; +import com.azure.resourcemanager.security.models.WorkspaceSetting; +import com.azure.resourcemanager.security.models.WorkspaceSettings; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class WorkspaceSettingsImpl implements WorkspaceSettings { + @JsonIgnore private final ClientLogger logger = new ClientLogger(WorkspaceSettingsImpl.class); + + private final WorkspaceSettingsClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public WorkspaceSettingsImpl( + WorkspaceSettingsClient innerClient, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new WorkspaceSettingImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new WorkspaceSettingImpl(inner1, this.manager())); + } + + public WorkspaceSetting get(String workspaceSettingName) { + WorkspaceSettingInner inner = this.serviceClient().get(workspaceSettingName); + if (inner != null) { + return new WorkspaceSettingImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse(String workspaceSettingName, Context context) { + Response inner = this.serviceClient().getWithResponse(workspaceSettingName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new WorkspaceSettingImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String workspaceSettingName) { + this.serviceClient().delete(workspaceSettingName); + } + + public Response deleteWithResponse(String workspaceSettingName, Context context) { + return this.serviceClient().deleteWithResponse(workspaceSettingName, context); + } + + public WorkspaceSetting getById(String id) { + String workspaceSettingName = Utils.getValueFromIdByName(id, "workspaceSettings"); + if (workspaceSettingName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'workspaceSettings'.", id))); + } + return this.getWithResponse(workspaceSettingName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String workspaceSettingName = Utils.getValueFromIdByName(id, "workspaceSettings"); + if (workspaceSettingName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'workspaceSettings'.", id))); + } + return this.getWithResponse(workspaceSettingName, context); + } + + public void deleteById(String id) { + String workspaceSettingName = Utils.getValueFromIdByName(id, "workspaceSettings"); + if (workspaceSettingName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'workspaceSettings'.", id))); + } + this.deleteWithResponse(workspaceSettingName, Context.NONE).getValue(); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String workspaceSettingName = Utils.getValueFromIdByName(id, "workspaceSettings"); + if (workspaceSettingName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'workspaceSettings'.", id))); + } + return this.deleteWithResponse(workspaceSettingName, context); + } + + private WorkspaceSettingsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } + + public WorkspaceSettingImpl define(String name) { + return new WorkspaceSettingImpl(name, this.manager()); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/package-info.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/package-info.java new file mode 100644 index 000000000000..5a853f731e88 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the implementations for SecurityCenter. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ +package com.azure.resourcemanager.security.implementation; diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AadConnectivityState.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AadConnectivityState.java new file mode 100644 index 000000000000..f1fede6bde7d --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AadConnectivityState.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Describes an Azure resource with kind. */ +@Fluent +public class AadConnectivityState { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AadConnectivityState.class); + + /* + * The connectivity state of the external AAD solution + */ + @JsonProperty(value = "connectivityState") + private AadConnectivityStateValue connectivityState; + + /** + * Get the connectivityState property: The connectivity state of the external AAD solution. + * + * @return the connectivityState value. + */ + public AadConnectivityStateValue connectivityState() { + return this.connectivityState; + } + + /** + * Set the connectivityState property: The connectivity state of the external AAD solution. + * + * @param connectivityState the connectivityState value to set. + * @return the AadConnectivityState object itself. + */ + public AadConnectivityState withConnectivityState(AadConnectivityStateValue connectivityState) { + this.connectivityState = connectivityState; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AadConnectivityStateValue.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AadConnectivityStateValue.java new file mode 100644 index 000000000000..5f2deb6227ff --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AadConnectivityStateValue.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for AadConnectivityStateValue. */ +public final class AadConnectivityStateValue extends ExpandableStringEnum { + /** Static value Discovered for AadConnectivityStateValue. */ + public static final AadConnectivityStateValue DISCOVERED = fromString("Discovered"); + + /** Static value NotLicensed for AadConnectivityStateValue. */ + public static final AadConnectivityStateValue NOT_LICENSED = fromString("NotLicensed"); + + /** Static value Connected for AadConnectivityStateValue. */ + public static final AadConnectivityStateValue CONNECTED = fromString("Connected"); + + /** + * Creates or finds a AadConnectivityStateValue from its string representation. + * + * @param name a name to look for. + * @return the corresponding AadConnectivityStateValue. + */ + @JsonCreator + public static AadConnectivityStateValue fromString(String name) { + return fromString(name, AadConnectivityStateValue.class); + } + + /** @return known AadConnectivityStateValue values. */ + public static Collection values() { + return values(AadConnectivityStateValue.class); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AadExternalSecuritySolution.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AadExternalSecuritySolution.java new file mode 100644 index 000000000000..051ffd08d238 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AadExternalSecuritySolution.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.models.ExternalSecuritySolutionInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** Represents an AAD identity protection solution which sends logs to an OMS workspace. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "kind") +@JsonTypeName("AAD") +@Fluent +public final class AadExternalSecuritySolution extends ExternalSecuritySolutionInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AadExternalSecuritySolution.class); + + /* + * The external security solution properties for AAD solutions + */ + @JsonProperty(value = "properties") + private AadSolutionProperties properties; + + /** + * Get the properties property: The external security solution properties for AAD solutions. + * + * @return the properties value. + */ + public AadSolutionProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The external security solution properties for AAD solutions. + * + * @param properties the properties value to set. + * @return the AadExternalSecuritySolution object itself. + */ + public AadExternalSecuritySolution withProperties(AadSolutionProperties properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AadSolutionProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AadSolutionProperties.java new file mode 100644 index 000000000000..e3611d63a3f1 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AadSolutionProperties.java @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The external security solution properties for AAD solutions. */ +@Fluent +public final class AadSolutionProperties extends ExternalSecuritySolutionProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AadSolutionProperties.class); + + /* + * The connectivity state of the external AAD solution + */ + @JsonProperty(value = "connectivityState") + private AadConnectivityStateValue connectivityState; + + /** + * Get the connectivityState property: The connectivity state of the external AAD solution. + * + * @return the connectivityState value. + */ + public AadConnectivityStateValue connectivityState() { + return this.connectivityState; + } + + /** + * Set the connectivityState property: The connectivity state of the external AAD solution. + * + * @param connectivityState the connectivityState value to set. + * @return the AadSolutionProperties object itself. + */ + public AadSolutionProperties withConnectivityState(AadConnectivityStateValue connectivityState) { + this.connectivityState = connectivityState; + return this; + } + + /** {@inheritDoc} */ + @Override + public AadSolutionProperties withDeviceVendor(String deviceVendor) { + super.withDeviceVendor(deviceVendor); + return this; + } + + /** {@inheritDoc} */ + @Override + public AadSolutionProperties withDeviceType(String deviceType) { + super.withDeviceType(deviceType); + return this; + } + + /** {@inheritDoc} */ + @Override + public AadSolutionProperties withWorkspace(ConnectedWorkspace workspace) { + super.withWorkspace(workspace); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ActionType.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ActionType.java new file mode 100644 index 000000000000..4fd4c65e3dc6 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ActionType.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ActionType. */ +public final class ActionType extends ExpandableStringEnum { + /** Static value LogicApp for ActionType. */ + public static final ActionType LOGIC_APP = fromString("LogicApp"); + + /** Static value EventHub for ActionType. */ + public static final ActionType EVENT_HUB = fromString("EventHub"); + + /** Static value Workspace for ActionType. */ + public static final ActionType WORKSPACE = fromString("Workspace"); + + /** + * Creates or finds a ActionType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ActionType. + */ + @JsonCreator + public static ActionType fromString(String name) { + return fromString(name, ActionType.class); + } + + /** @return known ActionType values. */ + public static Collection values() { + return values(ActionType.class); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ActiveConnectionsNotInAllowedRange.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ActiveConnectionsNotInAllowedRange.java new file mode 100644 index 000000000000..57966bd1ccd5 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ActiveConnectionsNotInAllowedRange.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.time.Duration; + +/** Number of active connections is not in allowed range. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "ruleType") +@JsonTypeName("ActiveConnectionsNotInAllowedRange") +@Fluent +public final class ActiveConnectionsNotInAllowedRange extends TimeWindowCustomAlertRule { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ActiveConnectionsNotInAllowedRange.class); + + /** {@inheritDoc} */ + @Override + public ActiveConnectionsNotInAllowedRange withTimeWindowSize(Duration timeWindowSize) { + super.withTimeWindowSize(timeWindowSize); + return this; + } + + /** {@inheritDoc} */ + @Override + public ActiveConnectionsNotInAllowedRange withMinThreshold(int minThreshold) { + super.withMinThreshold(minThreshold); + return this; + } + + /** {@inheritDoc} */ + @Override + public ActiveConnectionsNotInAllowedRange withMaxThreshold(int maxThreshold) { + super.withMaxThreshold(maxThreshold); + return this; + } + + /** {@inheritDoc} */ + @Override + public ActiveConnectionsNotInAllowedRange withIsEnabled(boolean isEnabled) { + super.withIsEnabled(isEnabled); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AdaptiveApplicationControlGroup.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AdaptiveApplicationControlGroup.java new file mode 100644 index 000000000000..57fb4ee27ac4 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AdaptiveApplicationControlGroup.java @@ -0,0 +1,297 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.AdaptiveApplicationControlGroupInner; +import java.util.List; + +/** An immutable client-side representation of AdaptiveApplicationControlGroup. */ +public interface AdaptiveApplicationControlGroup { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the enforcementMode property: The application control policy enforcement/protection mode of the machine + * group. + * + * @return the enforcementMode value. + */ + EnforcementMode enforcementMode(); + + /** + * Gets the protectionMode property: The protection mode of the collection/file types. Exe/Msi/Script are used for + * Windows, Executable is used for Linux. + * + * @return the protectionMode value. + */ + ProtectionMode protectionMode(); + + /** + * Gets the configurationStatus property: The configuration status of the machines group or machine or rule. + * + * @return the configurationStatus value. + */ + ConfigurationStatus configurationStatus(); + + /** + * Gets the recommendationStatus property: The initial recommendation status of the machine group or machine. + * + * @return the recommendationStatus value. + */ + RecommendationStatus recommendationStatus(); + + /** + * Gets the issues property: The issues property. + * + * @return the issues value. + */ + List issues(); + + /** + * Gets the sourceSystem property: The source type of the machine group. + * + * @return the sourceSystem value. + */ + SourceSystem sourceSystem(); + + /** + * Gets the vmRecommendations property: The vmRecommendations property. + * + * @return the vmRecommendations value. + */ + List vmRecommendations(); + + /** + * Gets the pathRecommendations property: The pathRecommendations property. + * + * @return the pathRecommendations value. + */ + List pathRecommendations(); + + /** + * Gets the location property: Location where the resource is stored. + * + * @return the location value. + */ + String location(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the inner com.azure.resourcemanager.security.fluent.models.AdaptiveApplicationControlGroupInner object. + * + * @return the inner object. + */ + AdaptiveApplicationControlGroupInner innerModel(); + + /** The entirety of the AdaptiveApplicationControlGroup definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The AdaptiveApplicationControlGroup definition stages. */ + interface DefinitionStages { + /** The first stage of the AdaptiveApplicationControlGroup definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the AdaptiveApplicationControlGroup definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies ascLocation. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @return the next definition stage. + */ + WithCreate withExistingLocation(String ascLocation); + } + /** + * The stage of the AdaptiveApplicationControlGroup definition which contains all the minimum required + * properties for the resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithEnforcementMode, + DefinitionStages.WithProtectionMode, + DefinitionStages.WithVmRecommendations, + DefinitionStages.WithPathRecommendations { + /** + * Executes the create request. + * + * @return the created resource. + */ + AdaptiveApplicationControlGroup create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + AdaptiveApplicationControlGroup create(Context context); + } + /** The stage of the AdaptiveApplicationControlGroup definition allowing to specify enforcementMode. */ + interface WithEnforcementMode { + /** + * Specifies the enforcementMode property: The application control policy enforcement/protection mode of the + * machine group. + * + * @param enforcementMode The application control policy enforcement/protection mode of the machine group. + * @return the next definition stage. + */ + WithCreate withEnforcementMode(EnforcementMode enforcementMode); + } + /** The stage of the AdaptiveApplicationControlGroup definition allowing to specify protectionMode. */ + interface WithProtectionMode { + /** + * Specifies the protectionMode property: The protection mode of the collection/file types. Exe/Msi/Script + * are used for Windows, Executable is used for Linux.. + * + * @param protectionMode The protection mode of the collection/file types. Exe/Msi/Script are used for + * Windows, Executable is used for Linux. + * @return the next definition stage. + */ + WithCreate withProtectionMode(ProtectionMode protectionMode); + } + /** The stage of the AdaptiveApplicationControlGroup definition allowing to specify vmRecommendations. */ + interface WithVmRecommendations { + /** + * Specifies the vmRecommendations property: The vmRecommendations property.. + * + * @param vmRecommendations The vmRecommendations property. + * @return the next definition stage. + */ + WithCreate withVmRecommendations(List vmRecommendations); + } + /** The stage of the AdaptiveApplicationControlGroup definition allowing to specify pathRecommendations. */ + interface WithPathRecommendations { + /** + * Specifies the pathRecommendations property: The pathRecommendations property.. + * + * @param pathRecommendations The pathRecommendations property. + * @return the next definition stage. + */ + WithCreate withPathRecommendations(List pathRecommendations); + } + } + /** + * Begins update for the AdaptiveApplicationControlGroup resource. + * + * @return the stage of resource update. + */ + AdaptiveApplicationControlGroup.Update update(); + + /** The template for AdaptiveApplicationControlGroup update. */ + interface Update + extends UpdateStages.WithEnforcementMode, + UpdateStages.WithProtectionMode, + UpdateStages.WithVmRecommendations, + UpdateStages.WithPathRecommendations { + /** + * Executes the update request. + * + * @return the updated resource. + */ + AdaptiveApplicationControlGroup apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + AdaptiveApplicationControlGroup apply(Context context); + } + /** The AdaptiveApplicationControlGroup update stages. */ + interface UpdateStages { + /** The stage of the AdaptiveApplicationControlGroup update allowing to specify enforcementMode. */ + interface WithEnforcementMode { + /** + * Specifies the enforcementMode property: The application control policy enforcement/protection mode of the + * machine group. + * + * @param enforcementMode The application control policy enforcement/protection mode of the machine group. + * @return the next definition stage. + */ + Update withEnforcementMode(EnforcementMode enforcementMode); + } + /** The stage of the AdaptiveApplicationControlGroup update allowing to specify protectionMode. */ + interface WithProtectionMode { + /** + * Specifies the protectionMode property: The protection mode of the collection/file types. Exe/Msi/Script + * are used for Windows, Executable is used for Linux.. + * + * @param protectionMode The protection mode of the collection/file types. Exe/Msi/Script are used for + * Windows, Executable is used for Linux. + * @return the next definition stage. + */ + Update withProtectionMode(ProtectionMode protectionMode); + } + /** The stage of the AdaptiveApplicationControlGroup update allowing to specify vmRecommendations. */ + interface WithVmRecommendations { + /** + * Specifies the vmRecommendations property: The vmRecommendations property.. + * + * @param vmRecommendations The vmRecommendations property. + * @return the next definition stage. + */ + Update withVmRecommendations(List vmRecommendations); + } + /** The stage of the AdaptiveApplicationControlGroup update allowing to specify pathRecommendations. */ + interface WithPathRecommendations { + /** + * Specifies the pathRecommendations property: The pathRecommendations property.. + * + * @param pathRecommendations The pathRecommendations property. + * @return the next definition stage. + */ + Update withPathRecommendations(List pathRecommendations); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + AdaptiveApplicationControlGroup refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + AdaptiveApplicationControlGroup refresh(Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AdaptiveApplicationControlGroups.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AdaptiveApplicationControlGroups.java new file mode 100644 index 000000000000..a394948e9205 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AdaptiveApplicationControlGroups.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.resourcemanager.security.fluent.models.AdaptiveApplicationControlGroupsInner; +import java.util.List; + +/** An immutable client-side representation of AdaptiveApplicationControlGroups. */ +public interface AdaptiveApplicationControlGroups { + /** + * Gets the value property: The value property. + * + * @return the value value. + */ + List value(); + + /** + * Gets the inner com.azure.resourcemanager.security.fluent.models.AdaptiveApplicationControlGroupsInner object. + * + * @return the inner object. + */ + AdaptiveApplicationControlGroupsInner innerModel(); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AdaptiveApplicationControlIssue.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AdaptiveApplicationControlIssue.java new file mode 100644 index 000000000000..d0a7c1544d0a --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AdaptiveApplicationControlIssue.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for AdaptiveApplicationControlIssue. */ +public final class AdaptiveApplicationControlIssue extends ExpandableStringEnum { + /** Static value ViolationsAudited for AdaptiveApplicationControlIssue. */ + public static final AdaptiveApplicationControlIssue VIOLATIONS_AUDITED = fromString("ViolationsAudited"); + + /** Static value ViolationsBlocked for AdaptiveApplicationControlIssue. */ + public static final AdaptiveApplicationControlIssue VIOLATIONS_BLOCKED = fromString("ViolationsBlocked"); + + /** Static value MsiAndScriptViolationsAudited for AdaptiveApplicationControlIssue. */ + public static final AdaptiveApplicationControlIssue MSI_AND_SCRIPT_VIOLATIONS_AUDITED = + fromString("MsiAndScriptViolationsAudited"); + + /** Static value MsiAndScriptViolationsBlocked for AdaptiveApplicationControlIssue. */ + public static final AdaptiveApplicationControlIssue MSI_AND_SCRIPT_VIOLATIONS_BLOCKED = + fromString("MsiAndScriptViolationsBlocked"); + + /** Static value ExecutableViolationsAudited for AdaptiveApplicationControlIssue. */ + public static final AdaptiveApplicationControlIssue EXECUTABLE_VIOLATIONS_AUDITED = + fromString("ExecutableViolationsAudited"); + + /** Static value RulesViolatedManually for AdaptiveApplicationControlIssue. */ + public static final AdaptiveApplicationControlIssue RULES_VIOLATED_MANUALLY = fromString("RulesViolatedManually"); + + /** + * Creates or finds a AdaptiveApplicationControlIssue from its string representation. + * + * @param name a name to look for. + * @return the corresponding AdaptiveApplicationControlIssue. + */ + @JsonCreator + public static AdaptiveApplicationControlIssue fromString(String name) { + return fromString(name, AdaptiveApplicationControlIssue.class); + } + + /** @return known AdaptiveApplicationControlIssue values. */ + public static Collection values() { + return values(AdaptiveApplicationControlIssue.class); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AdaptiveApplicationControlIssueSummary.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AdaptiveApplicationControlIssueSummary.java new file mode 100644 index 000000000000..d69d4dc36a2a --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AdaptiveApplicationControlIssueSummary.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Represents a summary of the alerts of the machine group. */ +@Fluent +public final class AdaptiveApplicationControlIssueSummary { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AdaptiveApplicationControlIssueSummary.class); + + /* + * An alert that machines within a group can have + */ + @JsonProperty(value = "issue") + private AdaptiveApplicationControlIssue issue; + + /* + * The number of machines in the group that have this alert + */ + @JsonProperty(value = "numberOfVms") + private Float numberOfVms; + + /** + * Get the issue property: An alert that machines within a group can have. + * + * @return the issue value. + */ + public AdaptiveApplicationControlIssue issue() { + return this.issue; + } + + /** + * Set the issue property: An alert that machines within a group can have. + * + * @param issue the issue value to set. + * @return the AdaptiveApplicationControlIssueSummary object itself. + */ + public AdaptiveApplicationControlIssueSummary withIssue(AdaptiveApplicationControlIssue issue) { + this.issue = issue; + return this; + } + + /** + * Get the numberOfVms property: The number of machines in the group that have this alert. + * + * @return the numberOfVms value. + */ + public Float numberOfVms() { + return this.numberOfVms; + } + + /** + * Set the numberOfVms property: The number of machines in the group that have this alert. + * + * @param numberOfVms the numberOfVms value to set. + * @return the AdaptiveApplicationControlIssueSummary object itself. + */ + public AdaptiveApplicationControlIssueSummary withNumberOfVms(Float numberOfVms) { + this.numberOfVms = numberOfVms; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AdaptiveApplicationControls.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AdaptiveApplicationControls.java new file mode 100644 index 000000000000..75e744aa563b --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AdaptiveApplicationControls.java @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of AdaptiveApplicationControls. */ +public interface AdaptiveApplicationControls { + /** + * Gets a list of application control machine groups for the subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of application control machine groups for the subscription. + */ + AdaptiveApplicationControlGroups list(); + + /** + * Gets a list of application control machine groups for the subscription. + * + * @param includePathRecommendations Include the policy rules. + * @param summary Return output in a summarized form. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of application control machine groups for the subscription. + */ + Response listWithResponse( + Boolean includePathRecommendations, Boolean summary, Context context); + + /** + * Gets an application control VM/server group. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param groupName Name of an application control machine group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an application control VM/server group. + */ + AdaptiveApplicationControlGroup get(String ascLocation, String groupName); + + /** + * Gets an application control VM/server group. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param groupName Name of an application control machine group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an application control VM/server group. + */ + Response getWithResponse(String ascLocation, String groupName, Context context); + + /** + * Delete an application control machine group. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param groupName Name of an application control machine group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup(String ascLocation, String groupName); + + /** + * Delete an application control machine group. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param groupName Name of an application control machine group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response deleteWithResponse(String ascLocation, String groupName, Context context); + + /** + * Gets an application control VM/server group. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an application control VM/server group. + */ + AdaptiveApplicationControlGroup getById(String id); + + /** + * Gets an application control VM/server group. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an application control VM/server group. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete an application control machine group. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Delete an application control machine group. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new AdaptiveApplicationControlGroup resource. + * + * @param name resource name. + * @return the first stage of the new AdaptiveApplicationControlGroup definition. + */ + AdaptiveApplicationControlGroup.DefinitionStages.Blank define(String name); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AdaptiveNetworkHardening.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AdaptiveNetworkHardening.java new file mode 100644 index 000000000000..8cd1c579fa38 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AdaptiveNetworkHardening.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.resourcemanager.security.fluent.models.AdaptiveNetworkHardeningInner; +import java.time.OffsetDateTime; +import java.util.List; + +/** An immutable client-side representation of AdaptiveNetworkHardening. */ +public interface AdaptiveNetworkHardening { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the rules property: The security rules which are recommended to be effective on the VM. + * + * @return the rules value. + */ + List rules(); + + /** + * Gets the rulesCalculationTime property: The UTC time on which the rules were calculated. + * + * @return the rulesCalculationTime value. + */ + OffsetDateTime rulesCalculationTime(); + + /** + * Gets the effectiveNetworkSecurityGroups property: The Network Security Groups effective on the network interfaces + * of the protected resource. + * + * @return the effectiveNetworkSecurityGroups value. + */ + List effectiveNetworkSecurityGroups(); + + /** + * Gets the inner com.azure.resourcemanager.security.fluent.models.AdaptiveNetworkHardeningInner object. + * + * @return the inner object. + */ + AdaptiveNetworkHardeningInner innerModel(); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AdaptiveNetworkHardeningEnforceRequest.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AdaptiveNetworkHardeningEnforceRequest.java new file mode 100644 index 000000000000..949ff15d0159 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AdaptiveNetworkHardeningEnforceRequest.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The AdaptiveNetworkHardeningEnforceRequest model. */ +@Fluent +public final class AdaptiveNetworkHardeningEnforceRequest { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AdaptiveNetworkHardeningEnforceRequest.class); + + /* + * The rules to enforce + */ + @JsonProperty(value = "rules", required = true) + private List rules; + + /* + * The Azure resource IDs of the effective network security groups that + * will be updated with the created security rules from the Adaptive + * Network Hardening rules + */ + @JsonProperty(value = "networkSecurityGroups", required = true) + private List networkSecurityGroups; + + /** + * Get the rules property: The rules to enforce. + * + * @return the rules value. + */ + public List rules() { + return this.rules; + } + + /** + * Set the rules property: The rules to enforce. + * + * @param rules the rules value to set. + * @return the AdaptiveNetworkHardeningEnforceRequest object itself. + */ + public AdaptiveNetworkHardeningEnforceRequest withRules(List rules) { + this.rules = rules; + return this; + } + + /** + * Get the networkSecurityGroups property: The Azure resource IDs of the effective network security groups that will + * be updated with the created security rules from the Adaptive Network Hardening rules. + * + * @return the networkSecurityGroups value. + */ + public List networkSecurityGroups() { + return this.networkSecurityGroups; + } + + /** + * Set the networkSecurityGroups property: The Azure resource IDs of the effective network security groups that will + * be updated with the created security rules from the Adaptive Network Hardening rules. + * + * @param networkSecurityGroups the networkSecurityGroups value to set. + * @return the AdaptiveNetworkHardeningEnforceRequest object itself. + */ + public AdaptiveNetworkHardeningEnforceRequest withNetworkSecurityGroups(List networkSecurityGroups) { + this.networkSecurityGroups = networkSecurityGroups; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (rules() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property rules in model AdaptiveNetworkHardeningEnforceRequest")); + } else { + rules().forEach(e -> e.validate()); + } + if (networkSecurityGroups() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property networkSecurityGroups in model" + + " AdaptiveNetworkHardeningEnforceRequest")); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AdaptiveNetworkHardenings.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AdaptiveNetworkHardenings.java new file mode 100644 index 000000000000..ba3dc50789af --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AdaptiveNetworkHardenings.java @@ -0,0 +1,135 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of AdaptiveNetworkHardenings. */ +public interface AdaptiveNetworkHardenings { + /** + * Gets a list of Adaptive Network Hardenings resources in scope of an extended resource. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Adaptive Network Hardenings resources in scope of an extended resource. + */ + PagedIterable listByExtendedResource( + String resourceGroupName, String resourceNamespace, String resourceType, String resourceName); + + /** + * Gets a list of Adaptive Network Hardenings resources in scope of an extended resource. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Adaptive Network Hardenings resources in scope of an extended resource. + */ + PagedIterable listByExtendedResource( + String resourceGroupName, String resourceNamespace, String resourceType, String resourceName, Context context); + + /** + * Gets a single Adaptive Network Hardening resource. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @param adaptiveNetworkHardeningResourceName The name of the Adaptive Network Hardening resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a single Adaptive Network Hardening resource. + */ + AdaptiveNetworkHardening get( + String resourceGroupName, + String resourceNamespace, + String resourceType, + String resourceName, + String adaptiveNetworkHardeningResourceName); + + /** + * Gets a single Adaptive Network Hardening resource. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @param adaptiveNetworkHardeningResourceName The name of the Adaptive Network Hardening resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a single Adaptive Network Hardening resource. + */ + Response getWithResponse( + String resourceGroupName, + String resourceNamespace, + String resourceType, + String resourceName, + String adaptiveNetworkHardeningResourceName, + Context context); + + /** + * Enforces the given rules on the NSG(s) listed in the request. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @param adaptiveNetworkHardeningResourceName The name of the Adaptive Network Hardening resource. + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void enforce( + String resourceGroupName, + String resourceNamespace, + String resourceType, + String resourceName, + String adaptiveNetworkHardeningResourceName, + AdaptiveNetworkHardeningEnforceRequest body); + + /** + * Enforces the given rules on the NSG(s) listed in the request. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @param adaptiveNetworkHardeningResourceName The name of the Adaptive Network Hardening resource. + * @param body The body parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void enforce( + String resourceGroupName, + String resourceNamespace, + String resourceType, + String resourceName, + String adaptiveNetworkHardeningResourceName, + AdaptiveNetworkHardeningEnforceRequest body, + Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AdaptiveNetworkHardeningsList.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AdaptiveNetworkHardeningsList.java new file mode 100644 index 000000000000..1267d7b0e9c4 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AdaptiveNetworkHardeningsList.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.models.AdaptiveNetworkHardeningInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Response for ListAdaptiveNetworkHardenings API service call. */ +@Fluent +public final class AdaptiveNetworkHardeningsList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AdaptiveNetworkHardeningsList.class); + + /* + * A list of Adaptive Network Hardenings resources + */ + @JsonProperty(value = "value") + private List value; + + /* + * The URL to get the next set of results + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: A list of Adaptive Network Hardenings resources. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: A list of Adaptive Network Hardenings resources. + * + * @param value the value value to set. + * @return the AdaptiveNetworkHardeningsList object itself. + */ + public AdaptiveNetworkHardeningsList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The URL to get the next set of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The URL to get the next set of results. + * + * @param nextLink the nextLink value to set. + * @return the AdaptiveNetworkHardeningsList object itself. + */ + public AdaptiveNetworkHardeningsList withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AdditionalData.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AdditionalData.java new file mode 100644 index 000000000000..c317eddf1844 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AdditionalData.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** Details of the sub-assessment. */ +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "assessedResourceType", + defaultImpl = AdditionalData.class) +@JsonTypeName("AdditionalData") +@JsonSubTypes({ + @JsonSubTypes.Type(name = "SqlServerVulnerability", value = SqlServerVulnerabilityProperties.class), + @JsonSubTypes.Type(name = "ContainerRegistryVulnerability", value = ContainerRegistryVulnerabilityProperties.class), + @JsonSubTypes.Type(name = "ServerVulnerabilityAssessment", value = ServerVulnerabilityProperties.class) +}) +@Immutable +public class AdditionalData { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AdditionalData.class); + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AdditionalWorkspaceDataType.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AdditionalWorkspaceDataType.java new file mode 100644 index 000000000000..1ef33cd715dc --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AdditionalWorkspaceDataType.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for AdditionalWorkspaceDataType. */ +public final class AdditionalWorkspaceDataType extends ExpandableStringEnum { + /** Static value Alerts for AdditionalWorkspaceDataType. */ + public static final AdditionalWorkspaceDataType ALERTS = fromString("Alerts"); + + /** Static value RawEvents for AdditionalWorkspaceDataType. */ + public static final AdditionalWorkspaceDataType RAW_EVENTS = fromString("RawEvents"); + + /** + * Creates or finds a AdditionalWorkspaceDataType from its string representation. + * + * @param name a name to look for. + * @return the corresponding AdditionalWorkspaceDataType. + */ + @JsonCreator + public static AdditionalWorkspaceDataType fromString(String name) { + return fromString(name, AdditionalWorkspaceDataType.class); + } + + /** @return known AdditionalWorkspaceDataType values. */ + public static Collection values() { + return values(AdditionalWorkspaceDataType.class); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AdditionalWorkspaceType.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AdditionalWorkspaceType.java new file mode 100644 index 000000000000..ff601cd68ae9 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AdditionalWorkspaceType.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for AdditionalWorkspaceType. */ +public final class AdditionalWorkspaceType extends ExpandableStringEnum { + /** Static value Sentinel for AdditionalWorkspaceType. */ + public static final AdditionalWorkspaceType SENTINEL = fromString("Sentinel"); + + /** + * Creates or finds a AdditionalWorkspaceType from its string representation. + * + * @param name a name to look for. + * @return the corresponding AdditionalWorkspaceType. + */ + @JsonCreator + public static AdditionalWorkspaceType fromString(String name) { + return fromString(name, AdditionalWorkspaceType.class); + } + + /** @return known AdditionalWorkspaceType values. */ + public static Collection values() { + return values(AdditionalWorkspaceType.class); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AdditionalWorkspacesProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AdditionalWorkspacesProperties.java new file mode 100644 index 000000000000..fb320d9f7394 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AdditionalWorkspacesProperties.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Properties of the additional workspaces. */ +@Fluent +public final class AdditionalWorkspacesProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AdditionalWorkspacesProperties.class); + + /* + * Workspace resource id + */ + @JsonProperty(value = "workspace") + private String workspace; + + /* + * Workspace type. + */ + @JsonProperty(value = "type") + private AdditionalWorkspaceType type; + + /* + * List of data types sent to workspace + */ + @JsonProperty(value = "dataTypes") + private List dataTypes; + + /** + * Get the workspace property: Workspace resource id. + * + * @return the workspace value. + */ + public String workspace() { + return this.workspace; + } + + /** + * Set the workspace property: Workspace resource id. + * + * @param workspace the workspace value to set. + * @return the AdditionalWorkspacesProperties object itself. + */ + public AdditionalWorkspacesProperties withWorkspace(String workspace) { + this.workspace = workspace; + return this; + } + + /** + * Get the type property: Workspace type. + * + * @return the type value. + */ + public AdditionalWorkspaceType type() { + return this.type; + } + + /** + * Set the type property: Workspace type. + * + * @param type the type value to set. + * @return the AdditionalWorkspacesProperties object itself. + */ + public AdditionalWorkspacesProperties withType(AdditionalWorkspaceType type) { + this.type = type; + return this; + } + + /** + * Get the dataTypes property: List of data types sent to workspace. + * + * @return the dataTypes value. + */ + public List dataTypes() { + return this.dataTypes; + } + + /** + * Set the dataTypes property: List of data types sent to workspace. + * + * @param dataTypes the dataTypes value to set. + * @return the AdditionalWorkspacesProperties object itself. + */ + public AdditionalWorkspacesProperties withDataTypes(List dataTypes) { + this.dataTypes = dataTypes; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AdvancedThreatProtectionSetting.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AdvancedThreatProtectionSetting.java new file mode 100644 index 000000000000..d7a8bd563ad0 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AdvancedThreatProtectionSetting.java @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.AdvancedThreatProtectionSettingInner; + +/** An immutable client-side representation of AdvancedThreatProtectionSetting. */ +public interface AdvancedThreatProtectionSetting { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the isEnabled property: Indicates whether Advanced Threat Protection is enabled. + * + * @return the isEnabled value. + */ + Boolean isEnabled(); + + /** + * Gets the inner com.azure.resourcemanager.security.fluent.models.AdvancedThreatProtectionSettingInner object. + * + * @return the inner object. + */ + AdvancedThreatProtectionSettingInner innerModel(); + + /** The entirety of the AdvancedThreatProtectionSetting definition. */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithScope, DefinitionStages.WithCreate { + } + /** The AdvancedThreatProtectionSetting definition stages. */ + interface DefinitionStages { + /** The first stage of the AdvancedThreatProtectionSetting definition. */ + interface Blank extends WithScope { + } + /** The stage of the AdvancedThreatProtectionSetting definition allowing to specify parent resource. */ + interface WithScope { + /** + * Specifies resourceId. + * + * @param resourceId The identifier of the resource. + * @return the next definition stage. + */ + WithCreate withExistingResourceId(String resourceId); + } + /** + * The stage of the AdvancedThreatProtectionSetting definition which contains all the minimum required + * properties for the resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithIsEnabled { + /** + * Executes the create request. + * + * @return the created resource. + */ + AdvancedThreatProtectionSetting create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + AdvancedThreatProtectionSetting create(Context context); + } + /** The stage of the AdvancedThreatProtectionSetting definition allowing to specify isEnabled. */ + interface WithIsEnabled { + /** + * Specifies the isEnabled property: Indicates whether Advanced Threat Protection is enabled.. + * + * @param isEnabled Indicates whether Advanced Threat Protection is enabled. + * @return the next definition stage. + */ + WithCreate withIsEnabled(Boolean isEnabled); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + AdvancedThreatProtectionSetting refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + AdvancedThreatProtectionSetting refresh(Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AdvancedThreatProtections.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AdvancedThreatProtections.java new file mode 100644 index 000000000000..22924ae9e1f4 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AdvancedThreatProtections.java @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of AdvancedThreatProtections. */ +public interface AdvancedThreatProtections { + /** + * Gets the Advanced Threat Protection settings for the specified resource. + * + * @param resourceId The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Advanced Threat Protection settings for the specified resource. + */ + AdvancedThreatProtectionSetting get(String resourceId); + + /** + * Gets the Advanced Threat Protection settings for the specified resource. + * + * @param resourceId The identifier of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Advanced Threat Protection settings for the specified resource. + */ + Response getWithResponse(String resourceId, Context context); + + /** + * Gets the Advanced Threat Protection settings for the specified resource. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Advanced Threat Protection settings for the specified resource. + */ + AdvancedThreatProtectionSetting getById(String id); + + /** + * Gets the Advanced Threat Protection settings for the specified resource. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Advanced Threat Protection settings for the specified resource. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new AdvancedThreatProtectionSetting resource. + * + * @return the first stage of the new AdvancedThreatProtectionSetting definition. + */ + AdvancedThreatProtectionSetting.DefinitionStages.Blank define(); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Alert.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Alert.java new file mode 100644 index 000000000000..284591e8a609 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Alert.java @@ -0,0 +1,212 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.resourcemanager.security.fluent.models.AlertInner; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; + +/** An immutable client-side representation of Alert. */ +public interface Alert { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the alertType property: Unique identifier for the detection logic (all alert instances from the same + * detection logic will have the same alertType). + * + * @return the alertType value. + */ + String alertType(); + + /** + * Gets the systemAlertId property: Unique identifier for the alert. + * + * @return the systemAlertId value. + */ + String systemAlertId(); + + /** + * Gets the productComponentName property: The name of Azure Security Center pricing tier which powering this alert. + * Learn more: https://docs.microsoft.com/en-us/azure/security-center/security-center-pricing. + * + * @return the productComponentName value. + */ + String productComponentName(); + + /** + * Gets the alertDisplayName property: The display name of the alert. + * + * @return the alertDisplayName value. + */ + String alertDisplayName(); + + /** + * Gets the description property: Description of the suspicious activity that was detected. + * + * @return the description value. + */ + String description(); + + /** + * Gets the severity property: The risk level of the threat that was detected. Learn more: + * https://docs.microsoft.com/en-us/azure/security-center/security-center-alerts-overview#how-are-alerts-classified. + * + * @return the severity value. + */ + AlertSeverity severity(); + + /** + * Gets the intent property: The kill chain related intent behind the alert. For list of supported values, and + * explanations of Azure Security Center's supported kill chain intents. + * + * @return the intent value. + */ + Intent intent(); + + /** + * Gets the startTimeUtc property: The UTC time of the first event or activity included in the alert in ISO8601 + * format. + * + * @return the startTimeUtc value. + */ + OffsetDateTime startTimeUtc(); + + /** + * Gets the endTimeUtc property: The UTC time of the last event or activity included in the alert in ISO8601 format. + * + * @return the endTimeUtc value. + */ + OffsetDateTime endTimeUtc(); + + /** + * Gets the resourceIdentifiers property: The resource identifiers that can be used to direct the alert to the right + * product exposure group (tenant, workspace, subscription etc.). There can be multiple identifiers of different + * type per alert. + * + * @return the resourceIdentifiers value. + */ + List resourceIdentifiers(); + + /** + * Gets the remediationSteps property: Manual action items to take to remediate the alert. + * + * @return the remediationSteps value. + */ + List remediationSteps(); + + /** + * Gets the vendorName property: The name of the vendor that raises the alert. + * + * @return the vendorName value. + */ + String vendorName(); + + /** + * Gets the status property: The life cycle status of the alert. + * + * @return the status value. + */ + AlertStatus status(); + + /** + * Gets the extendedLinks property: Links related to the alert. + * + * @return the extendedLinks value. + */ + List> extendedLinks(); + + /** + * Gets the alertUri property: A direct link to the alert page in Azure Portal. + * + * @return the alertUri value. + */ + String alertUri(); + + /** + * Gets the timeGeneratedUtc property: The UTC time the alert was generated in ISO8601 format. + * + * @return the timeGeneratedUtc value. + */ + OffsetDateTime timeGeneratedUtc(); + + /** + * Gets the productName property: The name of the product which published this alert (Azure Security Center, Azure + * ATP, Microsoft Defender ATP, O365 ATP, MCAS, and so on). + * + * @return the productName value. + */ + String productName(); + + /** + * Gets the processingEndTimeUtc property: The UTC processing end time of the alert in ISO8601 format. + * + * @return the processingEndTimeUtc value. + */ + OffsetDateTime processingEndTimeUtc(); + + /** + * Gets the entities property: A list of entities related to the alert. + * + * @return the entities value. + */ + List entities(); + + /** + * Gets the isIncident property: This field determines whether the alert is an incident (a compound grouping of + * several alerts) or a single alert. + * + * @return the isIncident value. + */ + Boolean isIncident(); + + /** + * Gets the correlationKey property: Key for corelating related alerts. Alerts with the same correlation key + * considered to be related. + * + * @return the correlationKey value. + */ + String correlationKey(); + + /** + * Gets the extendedProperties property: Custom properties for the alert. + * + * @return the extendedProperties value. + */ + Map extendedProperties(); + + /** + * Gets the compromisedEntity property: The display name of the resource most related to this alert. + * + * @return the compromisedEntity value. + */ + String compromisedEntity(); + + /** + * Gets the inner com.azure.resourcemanager.security.fluent.models.AlertInner object. + * + * @return the inner object. + */ + AlertInner innerModel(); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AlertEntity.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AlertEntity.java new file mode 100644 index 000000000000..7385ec310e32 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AlertEntity.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.HashMap; +import java.util.Map; + +/** Changing set of properties depending on the entity type. */ +@Fluent +public final class AlertEntity { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AlertEntity.class); + + /* + * Type of entity + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /* + * Changing set of properties depending on the entity type. + */ + @JsonIgnore private Map additionalProperties; + + /** + * Get the type property: Type of entity. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Get the additionalProperties property: Changing set of properties depending on the entity type. + * + * @return the additionalProperties value. + */ + @JsonAnyGetter + public Map additionalProperties() { + return this.additionalProperties; + } + + /** + * Set the additionalProperties property: Changing set of properties depending on the entity type. + * + * @param additionalProperties the additionalProperties value to set. + * @return the AlertEntity object itself. + */ + public AlertEntity withAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + @JsonAnySetter + void withAdditionalProperties(String key, Object value) { + if (additionalProperties == null) { + additionalProperties = new HashMap<>(); + } + additionalProperties.put(key, value); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AlertIntent.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AlertIntent.java new file mode 100644 index 000000000000..9e01ef809a19 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AlertIntent.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for AlertIntent. */ +public final class AlertIntent extends ExpandableStringEnum { + /** Static value Unknown for AlertIntent. */ + public static final AlertIntent UNKNOWN = fromString("Unknown"); + + /** Static value PreAttack for AlertIntent. */ + public static final AlertIntent PRE_ATTACK = fromString("PreAttack"); + + /** Static value InitialAccess for AlertIntent. */ + public static final AlertIntent INITIAL_ACCESS = fromString("InitialAccess"); + + /** Static value Persistence for AlertIntent. */ + public static final AlertIntent PERSISTENCE = fromString("Persistence"); + + /** Static value PrivilegeEscalation for AlertIntent. */ + public static final AlertIntent PRIVILEGE_ESCALATION = fromString("PrivilegeEscalation"); + + /** Static value DefenseEvasion for AlertIntent. */ + public static final AlertIntent DEFENSE_EVASION = fromString("DefenseEvasion"); + + /** Static value CredentialAccess for AlertIntent. */ + public static final AlertIntent CREDENTIAL_ACCESS = fromString("CredentialAccess"); + + /** Static value Discovery for AlertIntent. */ + public static final AlertIntent DISCOVERY = fromString("Discovery"); + + /** Static value LateralMovement for AlertIntent. */ + public static final AlertIntent LATERAL_MOVEMENT = fromString("LateralMovement"); + + /** Static value Execution for AlertIntent. */ + public static final AlertIntent EXECUTION = fromString("Execution"); + + /** Static value Collection for AlertIntent. */ + public static final AlertIntent COLLECTION = fromString("Collection"); + + /** Static value Exfiltration for AlertIntent. */ + public static final AlertIntent EXFILTRATION = fromString("Exfiltration"); + + /** Static value CommandAndControl for AlertIntent. */ + public static final AlertIntent COMMAND_AND_CONTROL = fromString("CommandAndControl"); + + /** Static value Impact for AlertIntent. */ + public static final AlertIntent IMPACT = fromString("Impact"); + + /** Static value Probing for AlertIntent. */ + public static final AlertIntent PROBING = fromString("Probing"); + + /** Static value Exploitation for AlertIntent. */ + public static final AlertIntent EXPLOITATION = fromString("Exploitation"); + + /** + * Creates or finds a AlertIntent from its string representation. + * + * @param name a name to look for. + * @return the corresponding AlertIntent. + */ + @JsonCreator + public static AlertIntent fromString(String name) { + return fromString(name, AlertIntent.class); + } + + /** @return known AlertIntent values. */ + public static Collection values() { + return values(AlertIntent.class); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AlertList.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AlertList.java new file mode 100644 index 000000000000..8ed0f080af91 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AlertList.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.models.AlertInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of security alerts. */ +@Fluent +public final class AlertList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AlertList.class); + + /* + * describes security alert properties. + */ + @JsonProperty(value = "value") + private List value; + + /* + * The URI to fetch the next page. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: describes security alert properties. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: describes security alert properties. + * + * @param value the value value to set. + * @return the AlertList object itself. + */ + public AlertList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The URI to fetch the next page. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AlertNotifications.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AlertNotifications.java new file mode 100644 index 000000000000..041c67b01ed1 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AlertNotifications.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for AlertNotifications. */ +public final class AlertNotifications extends ExpandableStringEnum { + /** Static value On for AlertNotifications. */ + public static final AlertNotifications ON = fromString("On"); + + /** Static value Off for AlertNotifications. */ + public static final AlertNotifications OFF = fromString("Off"); + + /** + * Creates or finds a AlertNotifications from its string representation. + * + * @param name a name to look for. + * @return the corresponding AlertNotifications. + */ + @JsonCreator + public static AlertNotifications fromString(String name) { + return fromString(name, AlertNotifications.class); + } + + /** @return known AlertNotifications values. */ + public static Collection values() { + return values(AlertNotifications.class); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AlertSeverity.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AlertSeverity.java new file mode 100644 index 000000000000..bd63a003dd7e --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AlertSeverity.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for AlertSeverity. */ +public final class AlertSeverity extends ExpandableStringEnum { + /** Static value Informational for AlertSeverity. */ + public static final AlertSeverity INFORMATIONAL = fromString("Informational"); + + /** Static value Low for AlertSeverity. */ + public static final AlertSeverity LOW = fromString("Low"); + + /** Static value Medium for AlertSeverity. */ + public static final AlertSeverity MEDIUM = fromString("Medium"); + + /** Static value High for AlertSeverity. */ + public static final AlertSeverity HIGH = fromString("High"); + + /** + * Creates or finds a AlertSeverity from its string representation. + * + * @param name a name to look for. + * @return the corresponding AlertSeverity. + */ + @JsonCreator + public static AlertSeverity fromString(String name) { + return fromString(name, AlertSeverity.class); + } + + /** @return known AlertSeverity values. */ + public static Collection values() { + return values(AlertSeverity.class); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AlertSimulatorBundlesRequestProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AlertSimulatorBundlesRequestProperties.java new file mode 100644 index 000000000000..9ec978614f08 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AlertSimulatorBundlesRequestProperties.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.util.List; + +/** Simulate alerts according to this bundles. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "kind") +@JsonTypeName("Bundles") +@Fluent +public final class AlertSimulatorBundlesRequestProperties extends AlertSimulatorRequestProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AlertSimulatorBundlesRequestProperties.class); + + /* + * Bundles list. + */ + @JsonProperty(value = "bundles") + private List bundles; + + /** + * Get the bundles property: Bundles list. + * + * @return the bundles value. + */ + public List bundles() { + return this.bundles; + } + + /** + * Set the bundles property: Bundles list. + * + * @param bundles the bundles value to set. + * @return the AlertSimulatorBundlesRequestProperties object itself. + */ + public AlertSimulatorBundlesRequestProperties withBundles(List bundles) { + this.bundles = bundles; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AlertSimulatorRequestBody.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AlertSimulatorRequestBody.java new file mode 100644 index 000000000000..129a020fac41 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AlertSimulatorRequestBody.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Alert Simulator request body. */ +@Fluent +public final class AlertSimulatorRequestBody { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AlertSimulatorRequestBody.class); + + /* + * Alert Simulator request body data. + */ + @JsonProperty(value = "properties") + private AlertSimulatorRequestProperties properties; + + /** + * Get the properties property: Alert Simulator request body data. + * + * @return the properties value. + */ + public AlertSimulatorRequestProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Alert Simulator request body data. + * + * @param properties the properties value to set. + * @return the AlertSimulatorRequestBody object itself. + */ + public AlertSimulatorRequestBody withProperties(AlertSimulatorRequestProperties properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AlertSimulatorRequestProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AlertSimulatorRequestProperties.java new file mode 100644 index 000000000000..434014d7d576 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AlertSimulatorRequestProperties.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.util.HashMap; +import java.util.Map; + +/** Describes properties of an alert simulation request. */ +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "kind", + defaultImpl = AlertSimulatorRequestProperties.class) +@JsonTypeName("AlertSimulatorRequestProperties") +@JsonSubTypes({@JsonSubTypes.Type(name = "Bundles", value = AlertSimulatorBundlesRequestProperties.class)}) +@Fluent +public class AlertSimulatorRequestProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AlertSimulatorRequestProperties.class); + + /* + * Describes properties of an alert simulation request + */ + @JsonIgnore private Map additionalProperties; + + /** + * Get the additionalProperties property: Describes properties of an alert simulation request. + * + * @return the additionalProperties value. + */ + @JsonAnyGetter + public Map additionalProperties() { + return this.additionalProperties; + } + + /** + * Set the additionalProperties property: Describes properties of an alert simulation request. + * + * @param additionalProperties the additionalProperties value to set. + * @return the AlertSimulatorRequestProperties object itself. + */ + public AlertSimulatorRequestProperties withAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + @JsonAnySetter + void withAdditionalProperties(String key, Object value) { + if (additionalProperties == null) { + additionalProperties = new HashMap<>(); + } + additionalProperties.put(key, value); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AlertStatus.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AlertStatus.java new file mode 100644 index 000000000000..5ff44df32c7a --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AlertStatus.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for AlertStatus. */ +public final class AlertStatus extends ExpandableStringEnum { + /** Static value Active for AlertStatus. */ + public static final AlertStatus ACTIVE = fromString("Active"); + + /** Static value Resolved for AlertStatus. */ + public static final AlertStatus RESOLVED = fromString("Resolved"); + + /** Static value Dismissed for AlertStatus. */ + public static final AlertStatus DISMISSED = fromString("Dismissed"); + + /** + * Creates or finds a AlertStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding AlertStatus. + */ + @JsonCreator + public static AlertStatus fromString(String name) { + return fromString(name, AlertStatus.class); + } + + /** @return known AlertStatus values. */ + public static Collection values() { + return values(AlertStatus.class); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AlertSyncSettings.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AlertSyncSettings.java new file mode 100644 index 000000000000..28e11c1d3f46 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AlertSyncSettings.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.models.SettingInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** Represents an alert sync setting. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "kind") +@JsonTypeName("AlertSyncSettings") +@JsonFlatten +@Fluent +public class AlertSyncSettings extends SettingInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AlertSyncSettings.class); + + /* + * Is the alert sync setting enabled + */ + @JsonProperty(value = "properties.enabled") + private Boolean enabled; + + /** + * Get the enabled property: Is the alert sync setting enabled. + * + * @return the enabled value. + */ + public Boolean enabled() { + return this.enabled; + } + + /** + * Set the enabled property: Is the alert sync setting enabled. + * + * @param enabled the enabled value to set. + * @return the AlertSyncSettings object itself. + */ + public AlertSyncSettings withEnabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Alerts.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Alerts.java new file mode 100644 index 000000000000..db410cb8a09f --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Alerts.java @@ -0,0 +1,369 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of Alerts. */ +public interface Alerts { + /** + * List all the alerts that are associated with the subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security alerts. + */ + PagedIterable list(); + + /** + * List all the alerts that are associated with the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security alerts. + */ + PagedIterable list(Context context); + + /** + * List all the alerts that are associated with the resource group. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security alerts. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List all the alerts that are associated with the resource group. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security alerts. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * List all the alerts that are associated with the subscription that are stored in a specific location. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security alerts. + */ + PagedIterable listSubscriptionLevelByRegion(String ascLocation); + + /** + * List all the alerts that are associated with the subscription that are stored in a specific location. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security alerts. + */ + PagedIterable listSubscriptionLevelByRegion(String ascLocation, Context context); + + /** + * List all the alerts that are associated with the resource group that are stored in a specific location. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security alerts. + */ + PagedIterable listResourceGroupLevelByRegion(String ascLocation, String resourceGroupName); + + /** + * List all the alerts that are associated with the resource group that are stored in a specific location. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security alerts. + */ + PagedIterable listResourceGroupLevelByRegion(String ascLocation, String resourceGroupName, Context context); + + /** + * Get an alert that is associated with a subscription. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param alertName Name of the alert object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an alert that is associated with a subscription. + */ + Alert getSubscriptionLevel(String ascLocation, String alertName); + + /** + * Get an alert that is associated with a subscription. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param alertName Name of the alert object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an alert that is associated with a subscription. + */ + Response getSubscriptionLevelWithResponse(String ascLocation, String alertName, Context context); + + /** + * Get an alert that is associated a resource group or a resource in a resource group. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param alertName Name of the alert object. + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an alert that is associated a resource group or a resource in a resource group. + */ + Alert getResourceGroupLevel(String ascLocation, String alertName, String resourceGroupName); + + /** + * Get an alert that is associated a resource group or a resource in a resource group. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param alertName Name of the alert object. + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an alert that is associated a resource group or a resource in a resource group. + */ + Response getResourceGroupLevelWithResponse( + String ascLocation, String alertName, String resourceGroupName, Context context); + + /** + * Update the alert's state. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param alertName Name of the alert object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void updateSubscriptionLevelStateToDismiss(String ascLocation, String alertName); + + /** + * Update the alert's state. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param alertName Name of the alert object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response updateSubscriptionLevelStateToDismissWithResponse( + String ascLocation, String alertName, Context context); + + /** + * Update the alert's state. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param alertName Name of the alert object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void updateSubscriptionLevelStateToResolve(String ascLocation, String alertName); + + /** + * Update the alert's state. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param alertName Name of the alert object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response updateSubscriptionLevelStateToResolveWithResponse( + String ascLocation, String alertName, Context context); + + /** + * Update the alert's state. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param alertName Name of the alert object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void updateSubscriptionLevelStateToActivate(String ascLocation, String alertName); + + /** + * Update the alert's state. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param alertName Name of the alert object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response updateSubscriptionLevelStateToActivateWithResponse( + String ascLocation, String alertName, Context context); + + /** + * Update the alert's state. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param alertName Name of the alert object. + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void updateResourceGroupLevelStateToResolve(String ascLocation, String alertName, String resourceGroupName); + + /** + * Update the alert's state. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param alertName Name of the alert object. + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response updateResourceGroupLevelStateToResolveWithResponse( + String ascLocation, String alertName, String resourceGroupName, Context context); + + /** + * Update the alert's state. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param alertName Name of the alert object. + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void updateResourceGroupLevelStateToDismiss(String ascLocation, String alertName, String resourceGroupName); + + /** + * Update the alert's state. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param alertName Name of the alert object. + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response updateResourceGroupLevelStateToDismissWithResponse( + String ascLocation, String alertName, String resourceGroupName, Context context); + + /** + * Update the alert's state. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param alertName Name of the alert object. + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void updateResourceGroupLevelStateToActivate(String ascLocation, String alertName, String resourceGroupName); + + /** + * Update the alert's state. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param alertName Name of the alert object. + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response updateResourceGroupLevelStateToActivateWithResponse( + String ascLocation, String alertName, String resourceGroupName, Context context); + + /** + * Simulate security alerts. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param alertSimulatorRequestBody Alert Simulator Request Properties. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void simulate(String ascLocation, AlertSimulatorRequestBody alertSimulatorRequestBody); + + /** + * Simulate security alerts. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param alertSimulatorRequestBody Alert Simulator Request Properties. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void simulate(String ascLocation, AlertSimulatorRequestBody alertSimulatorRequestBody, Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AlertsSuppressionRule.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AlertsSuppressionRule.java new file mode 100644 index 000000000000..4e7c2860f5f7 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AlertsSuppressionRule.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.resourcemanager.security.fluent.models.AlertsSuppressionRuleInner; +import java.time.OffsetDateTime; + +/** An immutable client-side representation of AlertsSuppressionRule. */ +public interface AlertsSuppressionRule { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the alertType property: Type of the alert to automatically suppress. For all alert types, use '*'. + * + * @return the alertType value. + */ + String alertType(); + + /** + * Gets the lastModifiedUtc property: The last time this rule was modified. + * + * @return the lastModifiedUtc value. + */ + OffsetDateTime lastModifiedUtc(); + + /** + * Gets the expirationDateUtc property: Expiration date of the rule, if value is not provided or provided as null + * this field will default to the maximum allowed expiration date. + * + * @return the expirationDateUtc value. + */ + OffsetDateTime expirationDateUtc(); + + /** + * Gets the reason property: The reason for dismissing the alert. + * + * @return the reason value. + */ + String reason(); + + /** + * Gets the state property: Possible states of the rule. + * + * @return the state value. + */ + RuleState state(); + + /** + * Gets the comment property: Any comment regarding the rule. + * + * @return the comment value. + */ + String comment(); + + /** + * Gets the suppressionAlertsScope property: The suppression conditions. + * + * @return the suppressionAlertsScope value. + */ + SuppressionAlertsScope suppressionAlertsScope(); + + /** + * Gets the inner com.azure.resourcemanager.security.fluent.models.AlertsSuppressionRuleInner object. + * + * @return the inner object. + */ + AlertsSuppressionRuleInner innerModel(); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AlertsSuppressionRules.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AlertsSuppressionRules.java new file mode 100644 index 000000000000..95b72bd73dca --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AlertsSuppressionRules.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.AlertsSuppressionRuleInner; + +/** Resource collection API of AlertsSuppressionRules. */ +public interface AlertsSuppressionRules { + /** + * List of all the dismiss rules for the given subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return suppression rules list for subscription. + */ + PagedIterable list(); + + /** + * List of all the dismiss rules for the given subscription. + * + * @param alertType Type of the alert to get rules for. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return suppression rules list for subscription. + */ + PagedIterable list(String alertType, Context context); + + /** + * Get dismiss rule, with name: {alertsSuppressionRuleName}, for the given subscription. + * + * @param alertsSuppressionRuleName The unique name of the suppression alert rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return dismiss rule, with name: {alertsSuppressionRuleName}, for the given subscription. + */ + AlertsSuppressionRule get(String alertsSuppressionRuleName); + + /** + * Get dismiss rule, with name: {alertsSuppressionRuleName}, for the given subscription. + * + * @param alertsSuppressionRuleName The unique name of the suppression alert rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return dismiss rule, with name: {alertsSuppressionRuleName}, for the given subscription. + */ + Response getWithResponse(String alertsSuppressionRuleName, Context context); + + /** + * Update existing rule or create new rule if it doesn't exist. + * + * @param alertsSuppressionRuleName The unique name of the suppression alert rule. + * @param alertsSuppressionRule Suppression rule object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the suppression rule. + */ + AlertsSuppressionRule update(String alertsSuppressionRuleName, AlertsSuppressionRuleInner alertsSuppressionRule); + + /** + * Update existing rule or create new rule if it doesn't exist. + * + * @param alertsSuppressionRuleName The unique name of the suppression alert rule. + * @param alertsSuppressionRule Suppression rule object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the suppression rule. + */ + Response updateWithResponse( + String alertsSuppressionRuleName, AlertsSuppressionRuleInner alertsSuppressionRule, Context context); + + /** + * Delete dismiss alert rule for this subscription. + * + * @param alertsSuppressionRuleName The unique name of the suppression alert rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String alertsSuppressionRuleName); + + /** + * Delete dismiss alert rule for this subscription. + * + * @param alertsSuppressionRuleName The unique name of the suppression alert rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response deleteWithResponse(String alertsSuppressionRuleName, Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AlertsSuppressionRulesList.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AlertsSuppressionRulesList.java new file mode 100644 index 000000000000..da729877a5a4 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AlertsSuppressionRulesList.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.models.AlertsSuppressionRuleInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Suppression rules list for subscription. */ +@Fluent +public final class AlertsSuppressionRulesList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AlertsSuppressionRulesList.class); + + /* + * The value property. + */ + @JsonProperty(value = "value", required = true) + private List value; + + /* + * URI to fetch the next page. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: The value property. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The value property. + * + * @param value the value value to set. + * @return the AlertsSuppressionRulesList object itself. + */ + public AlertsSuppressionRulesList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: URI to fetch the next page. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property value in model AlertsSuppressionRulesList")); + } else { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AlertsToAdmins.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AlertsToAdmins.java new file mode 100644 index 000000000000..6eed386246ae --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AlertsToAdmins.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for AlertsToAdmins. */ +public final class AlertsToAdmins extends ExpandableStringEnum { + /** Static value On for AlertsToAdmins. */ + public static final AlertsToAdmins ON = fromString("On"); + + /** Static value Off for AlertsToAdmins. */ + public static final AlertsToAdmins OFF = fromString("Off"); + + /** + * Creates or finds a AlertsToAdmins from its string representation. + * + * @param name a name to look for. + * @return the corresponding AlertsToAdmins. + */ + @JsonCreator + public static AlertsToAdmins fromString(String name) { + return fromString(name, AlertsToAdmins.class); + } + + /** @return known AlertsToAdmins values. */ + public static Collection values() { + return values(AlertsToAdmins.class); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AllowedConnections.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AllowedConnections.java new file mode 100644 index 000000000000..8f657ead6e8e --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AllowedConnections.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of AllowedConnections. */ +public interface AllowedConnections { + /** + * Gets the list of all possible traffic between resources for the subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of all possible traffic between resources for the subscription. + */ + PagedIterable list(); + + /** + * Gets the list of all possible traffic between resources for the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of all possible traffic between resources for the subscription. + */ + PagedIterable list(Context context); + + /** + * Gets the list of all possible traffic between resources for the subscription and location. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of all possible traffic between resources for the subscription and location. + */ + PagedIterable listByHomeRegion(String ascLocation); + + /** + * Gets the list of all possible traffic between resources for the subscription and location. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of all possible traffic between resources for the subscription and location. + */ + PagedIterable listByHomeRegion(String ascLocation, Context context); + + /** + * Gets the list of all possible traffic between resources for the subscription and location, based on connection + * type. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param connectionType The type of allowed connections (Internal, External). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of all possible traffic between resources for the subscription and location, based on connection + * type. + */ + AllowedConnectionsResource get(String resourceGroupName, String ascLocation, ConnectionType connectionType); + + /** + * Gets the list of all possible traffic between resources for the subscription and location, based on connection + * type. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param connectionType The type of allowed connections (Internal, External). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of all possible traffic between resources for the subscription and location, based on connection + * type. + */ + Response getWithResponse( + String resourceGroupName, String ascLocation, ConnectionType connectionType, Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AllowedConnectionsList.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AllowedConnectionsList.java new file mode 100644 index 000000000000..e7c9d8c49a32 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AllowedConnectionsList.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.models.AllowedConnectionsResourceInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of all possible traffic between Azure resources. */ +@Immutable +public final class AllowedConnectionsList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AllowedConnectionsList.class); + + /* + * The value property. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * The URI to fetch the next page. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: The value property. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The URI to fetch the next page. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AllowedConnectionsResource.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AllowedConnectionsResource.java new file mode 100644 index 000000000000..90f45e4f1b70 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AllowedConnectionsResource.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.resourcemanager.security.fluent.models.AllowedConnectionsResourceInner; +import java.time.OffsetDateTime; +import java.util.List; + +/** An immutable client-side representation of AllowedConnectionsResource. */ +public interface AllowedConnectionsResource { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the calculatedDateTime property: The UTC time on which the allowed connections resource was calculated. + * + * @return the calculatedDateTime value. + */ + OffsetDateTime calculatedDateTime(); + + /** + * Gets the connectableResources property: List of connectable resources. + * + * @return the connectableResources value. + */ + List connectableResources(); + + /** + * Gets the location property: Location where the resource is stored. + * + * @return the location value. + */ + String location(); + + /** + * Gets the inner com.azure.resourcemanager.security.fluent.models.AllowedConnectionsResourceInner object. + * + * @return the inner object. + */ + AllowedConnectionsResourceInner innerModel(); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AllowlistCustomAlertRule.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AllowlistCustomAlertRule.java new file mode 100644 index 000000000000..1926b7864346 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AllowlistCustomAlertRule.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.util.List; + +/** A custom alert rule that checks if a value (depends on the custom alert type) is allowed. */ +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "ruleType", + defaultImpl = AllowlistCustomAlertRule.class) +@JsonTypeName("AllowlistCustomAlertRule") +@JsonSubTypes({ + @JsonSubTypes.Type(name = "ConnectionToIpNotAllowed", value = ConnectionToIpNotAllowed.class), + @JsonSubTypes.Type(name = "ConnectionFromIpNotAllowed", value = ConnectionFromIpNotAllowed.class), + @JsonSubTypes.Type(name = "LocalUserNotAllowed", value = LocalUserNotAllowed.class), + @JsonSubTypes.Type(name = "ProcessNotAllowed", value = ProcessNotAllowed.class) +}) +@Fluent +public class AllowlistCustomAlertRule extends ListCustomAlertRule { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AllowlistCustomAlertRule.class); + + /* + * The values to allow. The format of the values depends on the rule type. + */ + @JsonProperty(value = "allowlistValues", required = true) + private List allowlistValues; + + /** + * Get the allowlistValues property: The values to allow. The format of the values depends on the rule type. + * + * @return the allowlistValues value. + */ + public List allowlistValues() { + return this.allowlistValues; + } + + /** + * Set the allowlistValues property: The values to allow. The format of the values depends on the rule type. + * + * @param allowlistValues the allowlistValues value to set. + * @return the AllowlistCustomAlertRule object itself. + */ + public AllowlistCustomAlertRule withAllowlistValues(List allowlistValues) { + this.allowlistValues = allowlistValues; + return this; + } + + /** {@inheritDoc} */ + @Override + public AllowlistCustomAlertRule withIsEnabled(boolean isEnabled) { + super.withIsEnabled(isEnabled); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (allowlistValues() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property allowlistValues in model AllowlistCustomAlertRule")); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AmqpC2DMessagesNotInAllowedRange.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AmqpC2DMessagesNotInAllowedRange.java new file mode 100644 index 000000000000..3f09e8a74f7f --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AmqpC2DMessagesNotInAllowedRange.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.time.Duration; + +/** Number of cloud to device messages (AMQP protocol) is not in allowed range. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "ruleType") +@JsonTypeName("AmqpC2DMessagesNotInAllowedRange") +@Fluent +public final class AmqpC2DMessagesNotInAllowedRange extends TimeWindowCustomAlertRule { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AmqpC2DMessagesNotInAllowedRange.class); + + /** {@inheritDoc} */ + @Override + public AmqpC2DMessagesNotInAllowedRange withTimeWindowSize(Duration timeWindowSize) { + super.withTimeWindowSize(timeWindowSize); + return this; + } + + /** {@inheritDoc} */ + @Override + public AmqpC2DMessagesNotInAllowedRange withMinThreshold(int minThreshold) { + super.withMinThreshold(minThreshold); + return this; + } + + /** {@inheritDoc} */ + @Override + public AmqpC2DMessagesNotInAllowedRange withMaxThreshold(int maxThreshold) { + super.withMaxThreshold(maxThreshold); + return this; + } + + /** {@inheritDoc} */ + @Override + public AmqpC2DMessagesNotInAllowedRange withIsEnabled(boolean isEnabled) { + super.withIsEnabled(isEnabled); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AmqpC2DRejectedMessagesNotInAllowedRange.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AmqpC2DRejectedMessagesNotInAllowedRange.java new file mode 100644 index 000000000000..a09b5432640a --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AmqpC2DRejectedMessagesNotInAllowedRange.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.time.Duration; + +/** Number of rejected cloud to device messages (AMQP protocol) is not in allowed range. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "ruleType") +@JsonTypeName("AmqpC2DRejectedMessagesNotInAllowedRange") +@Fluent +public final class AmqpC2DRejectedMessagesNotInAllowedRange extends TimeWindowCustomAlertRule { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AmqpC2DRejectedMessagesNotInAllowedRange.class); + + /** {@inheritDoc} */ + @Override + public AmqpC2DRejectedMessagesNotInAllowedRange withTimeWindowSize(Duration timeWindowSize) { + super.withTimeWindowSize(timeWindowSize); + return this; + } + + /** {@inheritDoc} */ + @Override + public AmqpC2DRejectedMessagesNotInAllowedRange withMinThreshold(int minThreshold) { + super.withMinThreshold(minThreshold); + return this; + } + + /** {@inheritDoc} */ + @Override + public AmqpC2DRejectedMessagesNotInAllowedRange withMaxThreshold(int maxThreshold) { + super.withMaxThreshold(maxThreshold); + return this; + } + + /** {@inheritDoc} */ + @Override + public AmqpC2DRejectedMessagesNotInAllowedRange withIsEnabled(boolean isEnabled) { + super.withIsEnabled(isEnabled); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AmqpD2CMessagesNotInAllowedRange.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AmqpD2CMessagesNotInAllowedRange.java new file mode 100644 index 000000000000..d47fbdd924eb --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AmqpD2CMessagesNotInAllowedRange.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.time.Duration; + +/** Number of device to cloud messages (AMQP protocol) is not in allowed range. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "ruleType") +@JsonTypeName("AmqpD2CMessagesNotInAllowedRange") +@Fluent +public final class AmqpD2CMessagesNotInAllowedRange extends TimeWindowCustomAlertRule { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AmqpD2CMessagesNotInAllowedRange.class); + + /** {@inheritDoc} */ + @Override + public AmqpD2CMessagesNotInAllowedRange withTimeWindowSize(Duration timeWindowSize) { + super.withTimeWindowSize(timeWindowSize); + return this; + } + + /** {@inheritDoc} */ + @Override + public AmqpD2CMessagesNotInAllowedRange withMinThreshold(int minThreshold) { + super.withMinThreshold(minThreshold); + return this; + } + + /** {@inheritDoc} */ + @Override + public AmqpD2CMessagesNotInAllowedRange withMaxThreshold(int maxThreshold) { + super.withMaxThreshold(maxThreshold); + return this; + } + + /** {@inheritDoc} */ + @Override + public AmqpD2CMessagesNotInAllowedRange withIsEnabled(boolean isEnabled) { + super.withIsEnabled(isEnabled); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AscLocation.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AscLocation.java new file mode 100644 index 000000000000..413df7f9f4d9 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AscLocation.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.resourcemanager.security.fluent.models.AscLocationInner; + +/** An immutable client-side representation of AscLocation. */ +public interface AscLocation { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the properties property: Any object. + * + * @return the properties value. + */ + Object properties(); + + /** + * Gets the inner com.azure.resourcemanager.security.fluent.models.AscLocationInner object. + * + * @return the inner object. + */ + AscLocationInner innerModel(); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AscLocationList.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AscLocationList.java new file mode 100644 index 000000000000..adba98ca35bf --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AscLocationList.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.models.AscLocationInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of locations where ASC saves your data. */ +@Immutable +public final class AscLocationList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AscLocationList.class); + + /* + * The value property. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * The URI to fetch the next page. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: The value property. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The URI to fetch the next page. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AssessedResourceType.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AssessedResourceType.java new file mode 100644 index 000000000000..e5d095a14f74 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AssessedResourceType.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for AssessedResourceType. */ +public final class AssessedResourceType extends ExpandableStringEnum { + /** Static value SqlServerVulnerability for AssessedResourceType. */ + public static final AssessedResourceType SQL_SERVER_VULNERABILITY = fromString("SqlServerVulnerability"); + + /** Static value ContainerRegistryVulnerability for AssessedResourceType. */ + public static final AssessedResourceType CONTAINER_REGISTRY_VULNERABILITY = + fromString("ContainerRegistryVulnerability"); + + /** Static value ServerVulnerability for AssessedResourceType. */ + public static final AssessedResourceType SERVER_VULNERABILITY = fromString("ServerVulnerability"); + + /** + * Creates or finds a AssessedResourceType from its string representation. + * + * @param name a name to look for. + * @return the corresponding AssessedResourceType. + */ + @JsonCreator + public static AssessedResourceType fromString(String name) { + return fromString(name, AssessedResourceType.class); + } + + /** @return known AssessedResourceType values. */ + public static Collection values() { + return values(AssessedResourceType.class); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AssessmentLinks.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AssessmentLinks.java new file mode 100644 index 000000000000..c5d754cd91e6 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AssessmentLinks.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Links relevant to the assessment. */ +@Immutable +public final class AssessmentLinks { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AssessmentLinks.class); + + /* + * Link to assessment in Azure Portal + */ + @JsonProperty(value = "azurePortalUri", access = JsonProperty.Access.WRITE_ONLY) + private String azurePortalUri; + + /** + * Get the azurePortalUri property: Link to assessment in Azure Portal. + * + * @return the azurePortalUri value. + */ + public String azurePortalUri() { + return this.azurePortalUri; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AssessmentStatus.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AssessmentStatus.java new file mode 100644 index 000000000000..3c7a749bdce1 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AssessmentStatus.java @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The result of the assessment. */ +@Fluent +public final class AssessmentStatus { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AssessmentStatus.class); + + /* + * Programmatic code for the status of the assessment + */ + @JsonProperty(value = "code", required = true) + private AssessmentStatusCode code; + + /* + * Programmatic code for the cause of the assessment status + */ + @JsonProperty(value = "cause") + private String cause; + + /* + * Human readable description of the assessment status + */ + @JsonProperty(value = "description") + private String description; + + /** + * Get the code property: Programmatic code for the status of the assessment. + * + * @return the code value. + */ + public AssessmentStatusCode code() { + return this.code; + } + + /** + * Set the code property: Programmatic code for the status of the assessment. + * + * @param code the code value to set. + * @return the AssessmentStatus object itself. + */ + public AssessmentStatus withCode(AssessmentStatusCode code) { + this.code = code; + return this; + } + + /** + * Get the cause property: Programmatic code for the cause of the assessment status. + * + * @return the cause value. + */ + public String cause() { + return this.cause; + } + + /** + * Set the cause property: Programmatic code for the cause of the assessment status. + * + * @param cause the cause value to set. + * @return the AssessmentStatus object itself. + */ + public AssessmentStatus withCause(String cause) { + this.cause = cause; + return this; + } + + /** + * Get the description property: Human readable description of the assessment status. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: Human readable description of the assessment status. + * + * @param description the description value to set. + * @return the AssessmentStatus object itself. + */ + public AssessmentStatus withDescription(String description) { + this.description = description; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (code() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property code in model AssessmentStatus")); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AssessmentStatusCode.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AssessmentStatusCode.java new file mode 100644 index 000000000000..98d921fc538f --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AssessmentStatusCode.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for AssessmentStatusCode. */ +public final class AssessmentStatusCode extends ExpandableStringEnum { + /** Static value Healthy for AssessmentStatusCode. */ + public static final AssessmentStatusCode HEALTHY = fromString("Healthy"); + + /** Static value Unhealthy for AssessmentStatusCode. */ + public static final AssessmentStatusCode UNHEALTHY = fromString("Unhealthy"); + + /** Static value NotApplicable for AssessmentStatusCode. */ + public static final AssessmentStatusCode NOT_APPLICABLE = fromString("NotApplicable"); + + /** + * Creates or finds a AssessmentStatusCode from its string representation. + * + * @param name a name to look for. + * @return the corresponding AssessmentStatusCode. + */ + @JsonCreator + public static AssessmentStatusCode fromString(String name) { + return fromString(name, AssessmentStatusCode.class); + } + + /** @return known AssessmentStatusCode values. */ + public static Collection values() { + return values(AssessmentStatusCode.class); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AssessmentType.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AssessmentType.java new file mode 100644 index 000000000000..2c779b5ccba6 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AssessmentType.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for AssessmentType. */ +public final class AssessmentType extends ExpandableStringEnum { + /** Static value BuiltIn for AssessmentType. */ + public static final AssessmentType BUILT_IN = fromString("BuiltIn"); + + /** Static value CustomPolicy for AssessmentType. */ + public static final AssessmentType CUSTOM_POLICY = fromString("CustomPolicy"); + + /** Static value CustomerManaged for AssessmentType. */ + public static final AssessmentType CUSTOMER_MANAGED = fromString("CustomerManaged"); + + /** Static value VerifiedPartner for AssessmentType. */ + public static final AssessmentType VERIFIED_PARTNER = fromString("VerifiedPartner"); + + /** + * Creates or finds a AssessmentType from its string representation. + * + * @param name a name to look for. + * @return the corresponding AssessmentType. + */ + @JsonCreator + public static AssessmentType fromString(String name) { + return fromString(name, AssessmentType.class); + } + + /** @return known AssessmentType values. */ + public static Collection values() { + return values(AssessmentType.class); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Assessments.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Assessments.java new file mode 100644 index 000000000000..db0c6b7e9d66 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Assessments.java @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of Assessments. */ +public interface Assessments { + /** + * Get security assessments on all your scanned resources inside a scope. + * + * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return security assessments on all your scanned resources inside a scope. + */ + PagedIterable list(String scope); + + /** + * Get security assessments on all your scanned resources inside a scope. + * + * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return security assessments on all your scanned resources inside a scope. + */ + PagedIterable list(String scope, Context context); + + /** + * Get a security assessment on your scanned resource. + * + * @param resourceId The identifier of the resource. + * @param assessmentName The Assessment Key - Unique key for the assessment type. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a security assessment on your scanned resource. + */ + SecurityAssessment get(String resourceId, String assessmentName); + + /** + * Get a security assessment on your scanned resource. + * + * @param resourceId The identifier of the resource. + * @param assessmentName The Assessment Key - Unique key for the assessment type. + * @param expand OData expand. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a security assessment on your scanned resource. + */ + Response getWithResponse( + String resourceId, String assessmentName, ExpandEnum expand, Context context); + + /** + * Delete a security assessment on your resource. An assessment metadata that describes this assessment must be + * predefined with the same name before inserting the assessment result. + * + * @param resourceId The identifier of the resource. + * @param assessmentName The Assessment Key - Unique key for the assessment type. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup(String resourceId, String assessmentName); + + /** + * Delete a security assessment on your resource. An assessment metadata that describes this assessment must be + * predefined with the same name before inserting the assessment result. + * + * @param resourceId The identifier of the resource. + * @param assessmentName The Assessment Key - Unique key for the assessment type. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response deleteWithResponse(String resourceId, String assessmentName, Context context); + + /** + * Get a security assessment on your scanned resource. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a security assessment on your scanned resource. + */ + SecurityAssessment getById(String id); + + /** + * Get a security assessment on your scanned resource. + * + * @param id the resource ID. + * @param expand OData expand. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a security assessment on your scanned resource. + */ + Response getByIdWithResponse(String id, ExpandEnum expand, Context context); + + /** + * Delete a security assessment on your resource. An assessment metadata that describes this assessment must be + * predefined with the same name before inserting the assessment result. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Delete a security assessment on your resource. An assessment metadata that describes this assessment must be + * predefined with the same name before inserting the assessment result. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new SecurityAssessment resource. + * + * @param name resource name. + * @return the first stage of the new SecurityAssessment definition. + */ + SecurityAssessment.DefinitionStages.Blank define(String name); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AssessmentsMetadatas.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AssessmentsMetadatas.java new file mode 100644 index 000000000000..2f5081440609 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AssessmentsMetadatas.java @@ -0,0 +1,177 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of AssessmentsMetadatas. */ +public interface AssessmentsMetadatas { + /** + * Get metadata information on all assessment types. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return metadata information on all assessment types. + */ + PagedIterable list(); + + /** + * Get metadata information on all assessment types. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return metadata information on all assessment types. + */ + PagedIterable list(Context context); + + /** + * Get metadata information on an assessment type. + * + * @param assessmentMetadataName The Assessment Key - Unique key for the assessment type. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return metadata information on an assessment type. + */ + SecurityAssessmentMetadata get(String assessmentMetadataName); + + /** + * Get metadata information on an assessment type. + * + * @param assessmentMetadataName The Assessment Key - Unique key for the assessment type. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return metadata information on an assessment type. + */ + Response getWithResponse(String assessmentMetadataName, Context context); + + /** + * Get metadata information on all assessment types in a specific subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return metadata information on all assessment types in a specific subscription. + */ + PagedIterable listBySubscription(); + + /** + * Get metadata information on all assessment types in a specific subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return metadata information on all assessment types in a specific subscription. + */ + PagedIterable listBySubscription(Context context); + + /** + * Get metadata information on an assessment type in a specific subscription. + * + * @param assessmentMetadataName The Assessment Key - Unique key for the assessment type. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return metadata information on an assessment type in a specific subscription. + */ + SecurityAssessmentMetadata getInSubscription(String assessmentMetadataName); + + /** + * Get metadata information on an assessment type in a specific subscription. + * + * @param assessmentMetadataName The Assessment Key - Unique key for the assessment type. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return metadata information on an assessment type in a specific subscription. + */ + Response getInSubscriptionWithResponse(String assessmentMetadataName, Context context); + + /** + * Delete metadata information on an assessment type in a specific subscription, will cause the deletion of all the + * assessments of that type in that subscription. + * + * @param assessmentMetadataName The Assessment Key - Unique key for the assessment type. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteInSubscription(String assessmentMetadataName); + + /** + * Delete metadata information on an assessment type in a specific subscription, will cause the deletion of all the + * assessments of that type in that subscription. + * + * @param assessmentMetadataName The Assessment Key - Unique key for the assessment type. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response deleteInSubscriptionWithResponse(String assessmentMetadataName, Context context); + + /** + * Get metadata information on an assessment type in a specific subscription. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return metadata information on an assessment type in a specific subscription. + */ + SecurityAssessmentMetadata getInSubscriptionById(String id); + + /** + * Get metadata information on an assessment type in a specific subscription. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return metadata information on an assessment type in a specific subscription. + */ + Response getInSubscriptionByIdWithResponse(String id, Context context); + + /** + * Delete metadata information on an assessment type in a specific subscription, will cause the deletion of all the + * assessments of that type in that subscription. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteInSubscriptionById(String id); + + /** + * Delete metadata information on an assessment type in a specific subscription, will cause the deletion of all the + * assessments of that type in that subscription. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response deleteInSubscriptionByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new SecurityAssessmentMetadata resource. + * + * @param name resource name. + * @return the first stage of the new SecurityAssessmentMetadata definition. + */ + SecurityAssessmentMetadata.DefinitionStages.Blank define(String name); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AtaExternalSecuritySolution.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AtaExternalSecuritySolution.java new file mode 100644 index 000000000000..9b20ca51e0e8 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AtaExternalSecuritySolution.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.models.ExternalSecuritySolutionInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** Represents an ATA security solution which sends logs to an OMS workspace. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "kind") +@JsonTypeName("ATA") +@Fluent +public final class AtaExternalSecuritySolution extends ExternalSecuritySolutionInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AtaExternalSecuritySolution.class); + + /* + * The external security solution properties for ATA solutions + */ + @JsonProperty(value = "properties") + private AtaSolutionProperties properties; + + /** + * Get the properties property: The external security solution properties for ATA solutions. + * + * @return the properties value. + */ + public AtaSolutionProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The external security solution properties for ATA solutions. + * + * @param properties the properties value to set. + * @return the AtaExternalSecuritySolution object itself. + */ + public AtaExternalSecuritySolution withProperties(AtaSolutionProperties properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AtaSolutionProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AtaSolutionProperties.java new file mode 100644 index 000000000000..3244abceecaf --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AtaSolutionProperties.java @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The external security solution properties for ATA solutions. */ +@Fluent +public final class AtaSolutionProperties extends ExternalSecuritySolutionProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AtaSolutionProperties.class); + + /* + * The lastEventReceived property. + */ + @JsonProperty(value = "lastEventReceived") + private String lastEventReceived; + + /** + * Get the lastEventReceived property: The lastEventReceived property. + * + * @return the lastEventReceived value. + */ + public String lastEventReceived() { + return this.lastEventReceived; + } + + /** + * Set the lastEventReceived property: The lastEventReceived property. + * + * @param lastEventReceived the lastEventReceived value to set. + * @return the AtaSolutionProperties object itself. + */ + public AtaSolutionProperties withLastEventReceived(String lastEventReceived) { + this.lastEventReceived = lastEventReceived; + return this; + } + + /** {@inheritDoc} */ + @Override + public AtaSolutionProperties withDeviceVendor(String deviceVendor) { + super.withDeviceVendor(deviceVendor); + return this; + } + + /** {@inheritDoc} */ + @Override + public AtaSolutionProperties withDeviceType(String deviceType) { + super.withDeviceType(deviceType); + return this; + } + + /** {@inheritDoc} */ + @Override + public AtaSolutionProperties withWorkspace(ConnectedWorkspace workspace) { + super.withWorkspace(workspace); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AuthenticationDetailsProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AuthenticationDetailsProperties.java new file mode 100644 index 000000000000..d4ebecb04155 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AuthenticationDetailsProperties.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.util.List; + +/** Settings for cloud authentication management. */ +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "authenticationType", + defaultImpl = AuthenticationDetailsProperties.class) +@JsonTypeName("AuthenticationDetailsProperties") +@JsonSubTypes({ + @JsonSubTypes.Type(name = "awsCreds", value = AwsCredsAuthenticationDetailsProperties.class), + @JsonSubTypes.Type(name = "awsAssumeRole", value = AwAssumeRoleAuthenticationDetailsProperties.class), + @JsonSubTypes.Type(name = "gcpCredentials", value = GcpCredentialsDetailsProperties.class) +}) +@Immutable +public class AuthenticationDetailsProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AuthenticationDetailsProperties.class); + + /* + * State of the multi-cloud connector + */ + @JsonProperty(value = "authenticationProvisioningState", access = JsonProperty.Access.WRITE_ONLY) + private AuthenticationProvisioningState authenticationProvisioningState; + + /* + * The permissions detected in the cloud account. + */ + @JsonProperty(value = "grantedPermissions", access = JsonProperty.Access.WRITE_ONLY) + private List grantedPermissions; + + /** + * Get the authenticationProvisioningState property: State of the multi-cloud connector. + * + * @return the authenticationProvisioningState value. + */ + public AuthenticationProvisioningState authenticationProvisioningState() { + return this.authenticationProvisioningState; + } + + /** + * Get the grantedPermissions property: The permissions detected in the cloud account. + * + * @return the grantedPermissions value. + */ + public List grantedPermissions() { + return this.grantedPermissions; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AuthenticationProvisioningState.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AuthenticationProvisioningState.java new file mode 100644 index 000000000000..c82c3aabf139 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AuthenticationProvisioningState.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for AuthenticationProvisioningState. */ +public final class AuthenticationProvisioningState extends ExpandableStringEnum { + /** Static value Valid for AuthenticationProvisioningState. */ + public static final AuthenticationProvisioningState VALID = fromString("Valid"); + + /** Static value Invalid for AuthenticationProvisioningState. */ + public static final AuthenticationProvisioningState INVALID = fromString("Invalid"); + + /** Static value Expired for AuthenticationProvisioningState. */ + public static final AuthenticationProvisioningState EXPIRED = fromString("Expired"); + + /** Static value IncorrectPolicy for AuthenticationProvisioningState. */ + public static final AuthenticationProvisioningState INCORRECT_POLICY = fromString("IncorrectPolicy"); + + /** + * Creates or finds a AuthenticationProvisioningState from its string representation. + * + * @param name a name to look for. + * @return the corresponding AuthenticationProvisioningState. + */ + @JsonCreator + public static AuthenticationProvisioningState fromString(String name) { + return fromString(name, AuthenticationProvisioningState.class); + } + + /** @return known AuthenticationProvisioningState values. */ + public static Collection values() { + return values(AuthenticationProvisioningState.class); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AuthenticationType.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AuthenticationType.java new file mode 100644 index 000000000000..387127426757 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AuthenticationType.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for AuthenticationType. */ +public final class AuthenticationType extends ExpandableStringEnum { + /** Static value awsCreds for AuthenticationType. */ + public static final AuthenticationType AWS_CREDS = fromString("awsCreds"); + + /** Static value awsAssumeRole for AuthenticationType. */ + public static final AuthenticationType AWS_ASSUME_ROLE = fromString("awsAssumeRole"); + + /** Static value gcpCredentials for AuthenticationType. */ + public static final AuthenticationType GCP_CREDENTIALS = fromString("gcpCredentials"); + + /** + * Creates or finds a AuthenticationType from its string representation. + * + * @param name a name to look for. + * @return the corresponding AuthenticationType. + */ + @JsonCreator + public static AuthenticationType fromString(String name) { + return fromString(name, AuthenticationType.class); + } + + /** @return known AuthenticationType values. */ + public static Collection values() { + return values(AuthenticationType.class); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AuthorizationState.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AuthorizationState.java new file mode 100644 index 000000000000..9d668debfd2a --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AuthorizationState.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for AuthorizationState. */ +public final class AuthorizationState extends ExpandableStringEnum { + /** Static value Authorized for AuthorizationState. */ + public static final AuthorizationState AUTHORIZED = fromString("Authorized"); + + /** Static value Unauthorized for AuthorizationState. */ + public static final AuthorizationState UNAUTHORIZED = fromString("Unauthorized"); + + /** + * Creates or finds a AuthorizationState from its string representation. + * + * @param name a name to look for. + * @return the corresponding AuthorizationState. + */ + @JsonCreator + public static AuthorizationState fromString(String name) { + return fromString(name, AuthorizationState.class); + } + + /** @return known AuthorizationState values. */ + public static Collection values() { + return values(AuthorizationState.class); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutoProvision.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutoProvision.java new file mode 100644 index 000000000000..607d2cb355d6 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutoProvision.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for AutoProvision. */ +public final class AutoProvision extends ExpandableStringEnum { + /** Static value On for AutoProvision. */ + public static final AutoProvision ON = fromString("On"); + + /** Static value Off for AutoProvision. */ + public static final AutoProvision OFF = fromString("Off"); + + /** + * Creates or finds a AutoProvision from its string representation. + * + * @param name a name to look for. + * @return the corresponding AutoProvision. + */ + @JsonCreator + public static AutoProvision fromString(String name) { + return fromString(name, AutoProvision.class); + } + + /** @return known AutoProvision values. */ + public static Collection values() { + return values(AutoProvision.class); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutoProvisioningSetting.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutoProvisioningSetting.java new file mode 100644 index 000000000000..df4279031dd7 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutoProvisioningSetting.java @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.AutoProvisioningSettingInner; + +/** An immutable client-side representation of AutoProvisioningSetting. */ +public interface AutoProvisioningSetting { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the autoProvision property: Describes what kind of security agent provisioning action to take. + * + * @return the autoProvision value. + */ + AutoProvision autoProvision(); + + /** + * Gets the inner com.azure.resourcemanager.security.fluent.models.AutoProvisioningSettingInner object. + * + * @return the inner object. + */ + AutoProvisioningSettingInner innerModel(); + + /** The entirety of the AutoProvisioningSetting definition. */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithCreate { + } + /** The AutoProvisioningSetting definition stages. */ + interface DefinitionStages { + /** The first stage of the AutoProvisioningSetting definition. */ + interface Blank extends WithCreate { + } + /** + * The stage of the AutoProvisioningSetting definition which contains all the minimum required properties for + * the resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithAutoProvision { + /** + * Executes the create request. + * + * @return the created resource. + */ + AutoProvisioningSetting create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + AutoProvisioningSetting create(Context context); + } + /** The stage of the AutoProvisioningSetting definition allowing to specify autoProvision. */ + interface WithAutoProvision { + /** + * Specifies the autoProvision property: Describes what kind of security agent provisioning action to take. + * + * @param autoProvision Describes what kind of security agent provisioning action to take. + * @return the next definition stage. + */ + WithCreate withAutoProvision(AutoProvision autoProvision); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + AutoProvisioningSetting refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + AutoProvisioningSetting refresh(Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutoProvisioningSettingList.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutoProvisioningSettingList.java new file mode 100644 index 000000000000..d2b6b6b6bb91 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutoProvisioningSettingList.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.models.AutoProvisioningSettingInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of all the auto provisioning settings response. */ +@Fluent +public final class AutoProvisioningSettingList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AutoProvisioningSettingList.class); + + /* + * List of all the auto provisioning settings + */ + @JsonProperty(value = "value") + private List value; + + /* + * The URI to fetch the next page. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: List of all the auto provisioning settings. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: List of all the auto provisioning settings. + * + * @param value the value value to set. + * @return the AutoProvisioningSettingList object itself. + */ + public AutoProvisioningSettingList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The URI to fetch the next page. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutoProvisioningSettings.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutoProvisioningSettings.java new file mode 100644 index 000000000000..9ef4a900f860 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutoProvisioningSettings.java @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of AutoProvisioningSettings. */ +public interface AutoProvisioningSettings { + /** + * Exposes the auto provisioning settings of the subscriptions. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of all the auto provisioning settings response. + */ + PagedIterable list(); + + /** + * Exposes the auto provisioning settings of the subscriptions. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of all the auto provisioning settings response. + */ + PagedIterable list(Context context); + + /** + * Details of a specific setting. + * + * @param settingName Auto provisioning setting key. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return auto provisioning setting. + */ + AutoProvisioningSetting get(String settingName); + + /** + * Details of a specific setting. + * + * @param settingName Auto provisioning setting key. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return auto provisioning setting. + */ + Response getWithResponse(String settingName, Context context); + + /** + * Details of a specific setting. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return auto provisioning setting. + */ + AutoProvisioningSetting getById(String id); + + /** + * Details of a specific setting. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return auto provisioning setting. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new AutoProvisioningSetting resource. + * + * @param name resource name. + * @return the first stage of the new AutoProvisioningSetting definition. + */ + AutoProvisioningSetting.DefinitionStages.Blank define(String name); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Automation.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Automation.java new file mode 100644 index 000000000000..c48c3fc9e75d --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Automation.java @@ -0,0 +1,387 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.AutomationInner; +import java.util.List; +import java.util.Map; + +/** An immutable client-side representation of Automation. */ +public interface Automation { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the description property: The security automation description. + * + * @return the description value. + */ + String description(); + + /** + * Gets the isEnabled property: Indicates whether the security automation is enabled. + * + * @return the isEnabled value. + */ + Boolean isEnabled(); + + /** + * Gets the scopes property: A collection of scopes on which the security automations logic is applied. Supported + * scopes are the subscription itself or a resource group under that subscription. The automation will only apply on + * defined scopes. + * + * @return the scopes value. + */ + List scopes(); + + /** + * Gets the sources property: A collection of the source event types which evaluate the security automation set of + * rules. + * + * @return the sources value. + */ + List sources(); + + /** + * Gets the actions property: A collection of the actions which are triggered if all the configured rules + * evaluations, within at least one rule set, are true. + * + * @return the actions value. + */ + List actions(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the inner com.azure.resourcemanager.security.fluent.models.AutomationInner object. + * + * @return the inner object. + */ + AutomationInner innerModel(); + + /** The entirety of the Automation definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithCreate { + } + /** The Automation definition stages. */ + interface DefinitionStages { + /** The first stage of the Automation definition. */ + interface Blank extends WithLocation { + } + /** The stage of the Automation definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(String location); + } + /** The stage of the Automation definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + /** + * The stage of the Automation definition which contains all the minimum required properties for the resource to + * be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithTags, + DefinitionStages.WithDescription, + DefinitionStages.WithIsEnabled, + DefinitionStages.WithScopes, + DefinitionStages.WithSources, + DefinitionStages.WithActions { + /** + * Executes the create request. + * + * @return the created resource. + */ + Automation create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + Automation create(Context context); + } + /** The stage of the Automation definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + /** The stage of the Automation definition allowing to specify description. */ + interface WithDescription { + /** + * Specifies the description property: The security automation description.. + * + * @param description The security automation description. + * @return the next definition stage. + */ + WithCreate withDescription(String description); + } + /** The stage of the Automation definition allowing to specify isEnabled. */ + interface WithIsEnabled { + /** + * Specifies the isEnabled property: Indicates whether the security automation is enabled.. + * + * @param isEnabled Indicates whether the security automation is enabled. + * @return the next definition stage. + */ + WithCreate withIsEnabled(Boolean isEnabled); + } + /** The stage of the Automation definition allowing to specify scopes. */ + interface WithScopes { + /** + * Specifies the scopes property: A collection of scopes on which the security automations logic is applied. + * Supported scopes are the subscription itself or a resource group under that subscription. The automation + * will only apply on defined scopes.. + * + * @param scopes A collection of scopes on which the security automations logic is applied. Supported scopes + * are the subscription itself or a resource group under that subscription. The automation will only + * apply on defined scopes. + * @return the next definition stage. + */ + WithCreate withScopes(List scopes); + } + /** The stage of the Automation definition allowing to specify sources. */ + interface WithSources { + /** + * Specifies the sources property: A collection of the source event types which evaluate the security + * automation set of rules.. + * + * @param sources A collection of the source event types which evaluate the security automation set of + * rules. + * @return the next definition stage. + */ + WithCreate withSources(List sources); + } + /** The stage of the Automation definition allowing to specify actions. */ + interface WithActions { + /** + * Specifies the actions property: A collection of the actions which are triggered if all the configured + * rules evaluations, within at least one rule set, are true.. + * + * @param actions A collection of the actions which are triggered if all the configured rules evaluations, + * within at least one rule set, are true. + * @return the next definition stage. + */ + WithCreate withActions(List actions); + } + } + /** + * Begins update for the Automation resource. + * + * @return the stage of resource update. + */ + Automation.Update update(); + + /** The template for Automation update. */ + interface Update + extends UpdateStages.WithTags, + UpdateStages.WithDescription, + UpdateStages.WithIsEnabled, + UpdateStages.WithScopes, + UpdateStages.WithSources, + UpdateStages.WithActions { + /** + * Executes the update request. + * + * @return the updated resource. + */ + Automation apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + Automation apply(Context context); + } + /** The Automation update stages. */ + interface UpdateStages { + /** The stage of the Automation update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + /** The stage of the Automation update allowing to specify description. */ + interface WithDescription { + /** + * Specifies the description property: The security automation description.. + * + * @param description The security automation description. + * @return the next definition stage. + */ + Update withDescription(String description); + } + /** The stage of the Automation update allowing to specify isEnabled. */ + interface WithIsEnabled { + /** + * Specifies the isEnabled property: Indicates whether the security automation is enabled.. + * + * @param isEnabled Indicates whether the security automation is enabled. + * @return the next definition stage. + */ + Update withIsEnabled(Boolean isEnabled); + } + /** The stage of the Automation update allowing to specify scopes. */ + interface WithScopes { + /** + * Specifies the scopes property: A collection of scopes on which the security automations logic is applied. + * Supported scopes are the subscription itself or a resource group under that subscription. The automation + * will only apply on defined scopes.. + * + * @param scopes A collection of scopes on which the security automations logic is applied. Supported scopes + * are the subscription itself or a resource group under that subscription. The automation will only + * apply on defined scopes. + * @return the next definition stage. + */ + Update withScopes(List scopes); + } + /** The stage of the Automation update allowing to specify sources. */ + interface WithSources { + /** + * Specifies the sources property: A collection of the source event types which evaluate the security + * automation set of rules.. + * + * @param sources A collection of the source event types which evaluate the security automation set of + * rules. + * @return the next definition stage. + */ + Update withSources(List sources); + } + /** The stage of the Automation update allowing to specify actions. */ + interface WithActions { + /** + * Specifies the actions property: A collection of the actions which are triggered if all the configured + * rules evaluations, within at least one rule set, are true.. + * + * @param actions A collection of the actions which are triggered if all the configured rules evaluations, + * within at least one rule set, are true. + * @return the next definition stage. + */ + Update withActions(List actions); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + Automation refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + Automation refresh(Context context); + + /** + * Validates the security automation model before create or update. Any validation errors are returned to the + * client. + * + * @param automation The security automation resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the security automation model state property bag. + */ + AutomationValidationStatus validate(AutomationInner automation); + + /** + * Validates the security automation model before create or update. Any validation errors are returned to the + * client. + * + * @param automation The security automation resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the security automation model state property bag. + */ + Response validateWithResponse(AutomationInner automation, Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutomationAction.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutomationAction.java new file mode 100644 index 000000000000..2c76ab3a214a --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutomationAction.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** The action that should be triggered. */ +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "actionType", + defaultImpl = AutomationAction.class) +@JsonTypeName("AutomationAction") +@JsonSubTypes({ + @JsonSubTypes.Type(name = "LogicApp", value = AutomationActionLogicApp.class), + @JsonSubTypes.Type(name = "EventHub", value = AutomationActionEventHub.class), + @JsonSubTypes.Type(name = "Workspace", value = AutomationActionWorkspace.class) +}) +@Immutable +public class AutomationAction { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AutomationAction.class); + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutomationActionEventHub.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutomationActionEventHub.java new file mode 100644 index 000000000000..17b7fd0e4c3b --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutomationActionEventHub.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * The target Event Hub to which event data will be exported. To learn more about Security Center continuous export + * capabilities, visit https://aka.ms/ASCExportLearnMore. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "actionType") +@JsonTypeName("EventHub") +@Fluent +public final class AutomationActionEventHub extends AutomationAction { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AutomationActionEventHub.class); + + /* + * The target Event Hub Azure Resource ID. + */ + @JsonProperty(value = "eventHubResourceId") + private String eventHubResourceId; + + /* + * The target Event Hub SAS policy name. + */ + @JsonProperty(value = "sasPolicyName", access = JsonProperty.Access.WRITE_ONLY) + private String sasPolicyName; + + /* + * The target Event Hub connection string (it will not be included in any + * response). + */ + @JsonProperty(value = "connectionString") + private String connectionString; + + /** + * Get the eventHubResourceId property: The target Event Hub Azure Resource ID. + * + * @return the eventHubResourceId value. + */ + public String eventHubResourceId() { + return this.eventHubResourceId; + } + + /** + * Set the eventHubResourceId property: The target Event Hub Azure Resource ID. + * + * @param eventHubResourceId the eventHubResourceId value to set. + * @return the AutomationActionEventHub object itself. + */ + public AutomationActionEventHub withEventHubResourceId(String eventHubResourceId) { + this.eventHubResourceId = eventHubResourceId; + return this; + } + + /** + * Get the sasPolicyName property: The target Event Hub SAS policy name. + * + * @return the sasPolicyName value. + */ + public String sasPolicyName() { + return this.sasPolicyName; + } + + /** + * Get the connectionString property: The target Event Hub connection string (it will not be included in any + * response). + * + * @return the connectionString value. + */ + public String connectionString() { + return this.connectionString; + } + + /** + * Set the connectionString property: The target Event Hub connection string (it will not be included in any + * response). + * + * @param connectionString the connectionString value to set. + * @return the AutomationActionEventHub object itself. + */ + public AutomationActionEventHub withConnectionString(String connectionString) { + this.connectionString = connectionString; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutomationActionLogicApp.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutomationActionLogicApp.java new file mode 100644 index 000000000000..74a65f421be3 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutomationActionLogicApp.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * The logic app action that should be triggered. To learn more about Security Center's Workflow Automation + * capabilities, visit https://aka.ms/ASCWorkflowAutomationLearnMore. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "actionType") +@JsonTypeName("LogicApp") +@Fluent +public final class AutomationActionLogicApp extends AutomationAction { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AutomationActionLogicApp.class); + + /* + * The triggered Logic App Azure Resource ID. This can also reside on other + * subscriptions, given that you have permissions to trigger the Logic App + */ + @JsonProperty(value = "logicAppResourceId") + private String logicAppResourceId; + + /* + * The Logic App trigger URI endpoint (it will not be included in any + * response). + */ + @JsonProperty(value = "uri") + private String uri; + + /** + * Get the logicAppResourceId property: The triggered Logic App Azure Resource ID. This can also reside on other + * subscriptions, given that you have permissions to trigger the Logic App. + * + * @return the logicAppResourceId value. + */ + public String logicAppResourceId() { + return this.logicAppResourceId; + } + + /** + * Set the logicAppResourceId property: The triggered Logic App Azure Resource ID. This can also reside on other + * subscriptions, given that you have permissions to trigger the Logic App. + * + * @param logicAppResourceId the logicAppResourceId value to set. + * @return the AutomationActionLogicApp object itself. + */ + public AutomationActionLogicApp withLogicAppResourceId(String logicAppResourceId) { + this.logicAppResourceId = logicAppResourceId; + return this; + } + + /** + * Get the uri property: The Logic App trigger URI endpoint (it will not be included in any response). + * + * @return the uri value. + */ + public String uri() { + return this.uri; + } + + /** + * Set the uri property: The Logic App trigger URI endpoint (it will not be included in any response). + * + * @param uri the uri value to set. + * @return the AutomationActionLogicApp object itself. + */ + public AutomationActionLogicApp withUri(String uri) { + this.uri = uri; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutomationActionWorkspace.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutomationActionWorkspace.java new file mode 100644 index 000000000000..0515709faef2 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutomationActionWorkspace.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * The Log Analytics Workspace to which event data will be exported. Security alerts data will reside in the + * 'SecurityAlert' table and the assessments data will reside in the 'SecurityRecommendation' table (under the + * 'Security'/'SecurityCenterFree' solutions). Note that in order to view the data in the workspace, the Security Center + * Log Analytics free/standard solution needs to be enabled on that workspace. To learn more about Security Center + * continuous export capabilities, visit https://aka.ms/ASCExportLearnMore. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "actionType") +@JsonTypeName("Workspace") +@Fluent +public final class AutomationActionWorkspace extends AutomationAction { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AutomationActionWorkspace.class); + + /* + * The fully qualified Log Analytics Workspace Azure Resource ID. + */ + @JsonProperty(value = "workspaceResourceId") + private String workspaceResourceId; + + /** + * Get the workspaceResourceId property: The fully qualified Log Analytics Workspace Azure Resource ID. + * + * @return the workspaceResourceId value. + */ + public String workspaceResourceId() { + return this.workspaceResourceId; + } + + /** + * Set the workspaceResourceId property: The fully qualified Log Analytics Workspace Azure Resource ID. + * + * @param workspaceResourceId the workspaceResourceId value to set. + * @return the AutomationActionWorkspace object itself. + */ + public AutomationActionWorkspace withWorkspaceResourceId(String workspaceResourceId) { + this.workspaceResourceId = workspaceResourceId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutomationList.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutomationList.java new file mode 100644 index 000000000000..be421845bd02 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutomationList.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.models.AutomationInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of security automations response. */ +@Fluent +public final class AutomationList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AutomationList.class); + + /* + * The list of security automations under the given scope. + */ + @JsonProperty(value = "value", required = true) + private List value; + + /* + * The URI to fetch the next page. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: The list of security automations under the given scope. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of security automations under the given scope. + * + * @param value the value value to set. + * @return the AutomationList object itself. + */ + public AutomationList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The URI to fetch the next page. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property value in model AutomationList")); + } else { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutomationRuleSet.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutomationRuleSet.java new file mode 100644 index 000000000000..d3c2a7c9be85 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutomationRuleSet.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * A rule set which evaluates all its rules upon an event interception. Only when all the included rules in the rule set + * will be evaluated as 'true', will the event trigger the defined actions. + */ +@Fluent +public final class AutomationRuleSet { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AutomationRuleSet.class); + + /* + * The rules property. + */ + @JsonProperty(value = "rules") + private List rules; + + /** + * Get the rules property: The rules property. + * + * @return the rules value. + */ + public List rules() { + return this.rules; + } + + /** + * Set the rules property: The rules property. + * + * @param rules the rules value to set. + * @return the AutomationRuleSet object itself. + */ + public AutomationRuleSet withRules(List rules) { + this.rules = rules; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (rules() != null) { + rules().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutomationScope.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutomationScope.java new file mode 100644 index 000000000000..a401fac07d81 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutomationScope.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A single automation scope. */ +@Fluent +public final class AutomationScope { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AutomationScope.class); + + /* + * The resources scope description. + */ + @JsonProperty(value = "description") + private String description; + + /* + * The resources scope path. Can be the subscription on which the + * automation is defined on or a resource group under that subscription + * (fully qualified Azure resource IDs). + */ + @JsonProperty(value = "scopePath") + private String scopePath; + + /** + * Get the description property: The resources scope description. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: The resources scope description. + * + * @param description the description value to set. + * @return the AutomationScope object itself. + */ + public AutomationScope withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the scopePath property: The resources scope path. Can be the subscription on which the automation is defined + * on or a resource group under that subscription (fully qualified Azure resource IDs). + * + * @return the scopePath value. + */ + public String scopePath() { + return this.scopePath; + } + + /** + * Set the scopePath property: The resources scope path. Can be the subscription on which the automation is defined + * on or a resource group under that subscription (fully qualified Azure resource IDs). + * + * @param scopePath the scopePath value to set. + * @return the AutomationScope object itself. + */ + public AutomationScope withScopePath(String scopePath) { + this.scopePath = scopePath; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutomationSource.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutomationSource.java new file mode 100644 index 000000000000..27f9488478a0 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutomationSource.java @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * The source event types which evaluate the security automation set of rules. For example - security alerts and + * security assessments. To learn more about the supported security events data models schemas - please visit + * https://aka.ms/ASCAutomationSchemas. + */ +@Fluent +public final class AutomationSource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AutomationSource.class); + + /* + * A valid event source type. + */ + @JsonProperty(value = "eventSource") + private EventSource eventSource; + + /* + * A set of rules which evaluate upon event interception. A logical + * disjunction is applied between defined rule sets (logical 'or'). + */ + @JsonProperty(value = "ruleSets") + private List ruleSets; + + /** + * Get the eventSource property: A valid event source type. + * + * @return the eventSource value. + */ + public EventSource eventSource() { + return this.eventSource; + } + + /** + * Set the eventSource property: A valid event source type. + * + * @param eventSource the eventSource value to set. + * @return the AutomationSource object itself. + */ + public AutomationSource withEventSource(EventSource eventSource) { + this.eventSource = eventSource; + return this; + } + + /** + * Get the ruleSets property: A set of rules which evaluate upon event interception. A logical disjunction is + * applied between defined rule sets (logical 'or'). + * + * @return the ruleSets value. + */ + public List ruleSets() { + return this.ruleSets; + } + + /** + * Set the ruleSets property: A set of rules which evaluate upon event interception. A logical disjunction is + * applied between defined rule sets (logical 'or'). + * + * @param ruleSets the ruleSets value to set. + * @return the AutomationSource object itself. + */ + public AutomationSource withRuleSets(List ruleSets) { + this.ruleSets = ruleSets; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (ruleSets() != null) { + ruleSets().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutomationTriggeringRule.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutomationTriggeringRule.java new file mode 100644 index 000000000000..94fd091099dc --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutomationTriggeringRule.java @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A rule which is evaluated upon event interception. The rule is configured by comparing a specific value from the + * event model to an expected value. This comparison is done by using one of the supported operators set. + */ +@Fluent +public final class AutomationTriggeringRule { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AutomationTriggeringRule.class); + + /* + * The JPath of the entity model property that should be checked. + */ + @JsonProperty(value = "propertyJPath") + private String propertyJPath; + + /* + * The data type of the compared operands (string, integer, floating point + * number or a boolean [true/false]] + */ + @JsonProperty(value = "propertyType") + private PropertyType propertyType; + + /* + * The expected value. + */ + @JsonProperty(value = "expectedValue") + private String expectedValue; + + /* + * A valid comparer operator to use. A case-insensitive comparison will be + * applied for String PropertyType. + */ + @JsonProperty(value = "operator") + private Operator operator; + + /** + * Get the propertyJPath property: The JPath of the entity model property that should be checked. + * + * @return the propertyJPath value. + */ + public String propertyJPath() { + return this.propertyJPath; + } + + /** + * Set the propertyJPath property: The JPath of the entity model property that should be checked. + * + * @param propertyJPath the propertyJPath value to set. + * @return the AutomationTriggeringRule object itself. + */ + public AutomationTriggeringRule withPropertyJPath(String propertyJPath) { + this.propertyJPath = propertyJPath; + return this; + } + + /** + * Get the propertyType property: The data type of the compared operands (string, integer, floating point number or + * a boolean [true/false]]. + * + * @return the propertyType value. + */ + public PropertyType propertyType() { + return this.propertyType; + } + + /** + * Set the propertyType property: The data type of the compared operands (string, integer, floating point number or + * a boolean [true/false]]. + * + * @param propertyType the propertyType value to set. + * @return the AutomationTriggeringRule object itself. + */ + public AutomationTriggeringRule withPropertyType(PropertyType propertyType) { + this.propertyType = propertyType; + return this; + } + + /** + * Get the expectedValue property: The expected value. + * + * @return the expectedValue value. + */ + public String expectedValue() { + return this.expectedValue; + } + + /** + * Set the expectedValue property: The expected value. + * + * @param expectedValue the expectedValue value to set. + * @return the AutomationTriggeringRule object itself. + */ + public AutomationTriggeringRule withExpectedValue(String expectedValue) { + this.expectedValue = expectedValue; + return this; + } + + /** + * Get the operator property: A valid comparer operator to use. A case-insensitive comparison will be applied for + * String PropertyType. + * + * @return the operator value. + */ + public Operator operator() { + return this.operator; + } + + /** + * Set the operator property: A valid comparer operator to use. A case-insensitive comparison will be applied for + * String PropertyType. + * + * @param operator the operator value to set. + * @return the AutomationTriggeringRule object itself. + */ + public AutomationTriggeringRule withOperator(Operator operator) { + this.operator = operator; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutomationValidationStatus.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutomationValidationStatus.java new file mode 100644 index 000000000000..61079decd3e6 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutomationValidationStatus.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.resourcemanager.security.fluent.models.AutomationValidationStatusInner; + +/** An immutable client-side representation of AutomationValidationStatus. */ +public interface AutomationValidationStatus { + /** + * Gets the isValid property: Indicates whether the model is valid or not. + * + * @return the isValid value. + */ + Boolean isValid(); + + /** + * Gets the message property: The validation message. + * + * @return the message value. + */ + String message(); + + /** + * Gets the inner com.azure.resourcemanager.security.fluent.models.AutomationValidationStatusInner object. + * + * @return the inner object. + */ + AutomationValidationStatusInner innerModel(); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Automations.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Automations.java new file mode 100644 index 000000000000..acd2e6a97b3a --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Automations.java @@ -0,0 +1,201 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.AutomationInner; + +/** Resource collection API of Automations. */ +public interface Automations { + /** + * Lists all the security automations in the specified subscription. Use the 'nextLink' property in the response to + * get the next page of security automations for the specified subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security automations response. + */ + PagedIterable list(); + + /** + * Lists all the security automations in the specified subscription. Use the 'nextLink' property in the response to + * get the next page of security automations for the specified subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security automations response. + */ + PagedIterable list(Context context); + + /** + * Lists all the security automations in the specified resource group. Use the 'nextLink' property in the response + * to get the next page of security automations for the specified resource group. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security automations response. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Lists all the security automations in the specified resource group. Use the 'nextLink' property in the response + * to get the next page of security automations for the specified resource group. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security automations response. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Retrieves information about the model of a security automation. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param automationName The security automation name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the security automation resource. + */ + Automation getByResourceGroup(String resourceGroupName, String automationName); + + /** + * Retrieves information about the model of a security automation. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param automationName The security automation name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the security automation resource. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, String automationName, Context context); + + /** + * Deletes a security automation. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param automationName The security automation name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup(String resourceGroupName, String automationName); + + /** + * Deletes a security automation. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param automationName The security automation name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response deleteWithResponse(String resourceGroupName, String automationName, Context context); + + /** + * Validates the security automation model before create or update. Any validation errors are returned to the + * client. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param automationName The security automation name. + * @param automation The security automation resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the security automation model state property bag. + */ + AutomationValidationStatus validate(String resourceGroupName, String automationName, AutomationInner automation); + + /** + * Validates the security automation model before create or update. Any validation errors are returned to the + * client. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param automationName The security automation name. + * @param automation The security automation resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the security automation model state property bag. + */ + Response validateWithResponse( + String resourceGroupName, String automationName, AutomationInner automation, Context context); + + /** + * Retrieves information about the model of a security automation. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the security automation resource. + */ + Automation getById(String id); + + /** + * Retrieves information about the model of a security automation. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the security automation resource. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a security automation. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes a security automation. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new Automation resource. + * + * @param name resource name. + * @return the first stage of the new Automation definition. + */ + Automation.DefinitionStages.Blank define(String name); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AwAssumeRoleAuthenticationDetailsProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AwAssumeRoleAuthenticationDetailsProperties.java new file mode 100644 index 000000000000..f6eba272c8d3 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AwAssumeRoleAuthenticationDetailsProperties.java @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * AWS cloud account connector based assume role, the role enables delegating access to your AWS resources. The role is + * composed of role Amazon Resource Name (ARN) and external ID. For more details, refer to <a + * href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_create_for-user.html">Creating a Role to Delegate + * Permissions to an IAM User (write only)</a>. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "authenticationType") +@JsonTypeName("awsAssumeRole") +@Fluent +public final class AwAssumeRoleAuthenticationDetailsProperties extends AuthenticationDetailsProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AwAssumeRoleAuthenticationDetailsProperties.class); + + /* + * The ID of the cloud account + */ + @JsonProperty(value = "accountId", access = JsonProperty.Access.WRITE_ONLY) + private String accountId; + + /* + * Assumed role ID is an identifier that you can use to create temporary + * security credentials. + */ + @JsonProperty(value = "awsAssumeRoleArn", required = true) + private String awsAssumeRoleArn; + + /* + * A unique identifier that is required when you assume a role in another + * account. + */ + @JsonProperty(value = "awsExternalId", required = true) + private String awsExternalId; + + /** + * Get the accountId property: The ID of the cloud account. + * + * @return the accountId value. + */ + public String accountId() { + return this.accountId; + } + + /** + * Get the awsAssumeRoleArn property: Assumed role ID is an identifier that you can use to create temporary security + * credentials. + * + * @return the awsAssumeRoleArn value. + */ + public String awsAssumeRoleArn() { + return this.awsAssumeRoleArn; + } + + /** + * Set the awsAssumeRoleArn property: Assumed role ID is an identifier that you can use to create temporary security + * credentials. + * + * @param awsAssumeRoleArn the awsAssumeRoleArn value to set. + * @return the AwAssumeRoleAuthenticationDetailsProperties object itself. + */ + public AwAssumeRoleAuthenticationDetailsProperties withAwsAssumeRoleArn(String awsAssumeRoleArn) { + this.awsAssumeRoleArn = awsAssumeRoleArn; + return this; + } + + /** + * Get the awsExternalId property: A unique identifier that is required when you assume a role in another account. + * + * @return the awsExternalId value. + */ + public String awsExternalId() { + return this.awsExternalId; + } + + /** + * Set the awsExternalId property: A unique identifier that is required when you assume a role in another account. + * + * @param awsExternalId the awsExternalId value to set. + * @return the AwAssumeRoleAuthenticationDetailsProperties object itself. + */ + public AwAssumeRoleAuthenticationDetailsProperties withAwsExternalId(String awsExternalId) { + this.awsExternalId = awsExternalId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (awsAssumeRoleArn() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property awsAssumeRoleArn in model" + + " AwAssumeRoleAuthenticationDetailsProperties")); + } + if (awsExternalId() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property awsExternalId in model" + + " AwAssumeRoleAuthenticationDetailsProperties")); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AwsCredsAuthenticationDetailsProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AwsCredsAuthenticationDetailsProperties.java new file mode 100644 index 000000000000..b49796fea8f8 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AwsCredsAuthenticationDetailsProperties.java @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * AWS cloud account connector based credentials, the credentials is composed of access key ID and secret key, for more + * details, refer to <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_users_create.html">Creating an + * IAM User in Your AWS Account (write only)</a>. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "authenticationType") +@JsonTypeName("awsCreds") +@Fluent +public final class AwsCredsAuthenticationDetailsProperties extends AuthenticationDetailsProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AwsCredsAuthenticationDetailsProperties.class); + + /* + * The ID of the cloud account + */ + @JsonProperty(value = "accountId", access = JsonProperty.Access.WRITE_ONLY) + private String accountId; + + /* + * Public key element of the AWS credential object (write only) + */ + @JsonProperty(value = "awsAccessKeyId", required = true) + private String awsAccessKeyId; + + /* + * Secret key element of the AWS credential object (write only) + */ + @JsonProperty(value = "awsSecretAccessKey", required = true) + private String awsSecretAccessKey; + + /** + * Get the accountId property: The ID of the cloud account. + * + * @return the accountId value. + */ + public String accountId() { + return this.accountId; + } + + /** + * Get the awsAccessKeyId property: Public key element of the AWS credential object (write only). + * + * @return the awsAccessKeyId value. + */ + public String awsAccessKeyId() { + return this.awsAccessKeyId; + } + + /** + * Set the awsAccessKeyId property: Public key element of the AWS credential object (write only). + * + * @param awsAccessKeyId the awsAccessKeyId value to set. + * @return the AwsCredsAuthenticationDetailsProperties object itself. + */ + public AwsCredsAuthenticationDetailsProperties withAwsAccessKeyId(String awsAccessKeyId) { + this.awsAccessKeyId = awsAccessKeyId; + return this; + } + + /** + * Get the awsSecretAccessKey property: Secret key element of the AWS credential object (write only). + * + * @return the awsSecretAccessKey value. + */ + public String awsSecretAccessKey() { + return this.awsSecretAccessKey; + } + + /** + * Set the awsSecretAccessKey property: Secret key element of the AWS credential object (write only). + * + * @param awsSecretAccessKey the awsSecretAccessKey value to set. + * @return the AwsCredsAuthenticationDetailsProperties object itself. + */ + public AwsCredsAuthenticationDetailsProperties withAwsSecretAccessKey(String awsSecretAccessKey) { + this.awsSecretAccessKey = awsSecretAccessKey; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (awsAccessKeyId() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property awsAccessKeyId in model AwsCredsAuthenticationDetailsProperties")); + } + if (awsSecretAccessKey() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property awsSecretAccessKey in model" + + " AwsCredsAuthenticationDetailsProperties")); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AzureResourceDetails.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AzureResourceDetails.java new file mode 100644 index 000000000000..6bef396459fc --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AzureResourceDetails.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** Details of the Azure resource that was assessed. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "source") +@JsonTypeName("Azure") +@Immutable +public final class AzureResourceDetails extends ResourceDetails { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AzureResourceDetails.class); + + /* + * Azure resource Id of the assessed resource + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /** + * Get the id property: Azure resource Id of the assessed resource. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AzureResourceIdentifier.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AzureResourceIdentifier.java new file mode 100644 index 000000000000..87bf4763c73b --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AzureResourceIdentifier.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** Azure resource identifier. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("AzureResource") +@Immutable +public final class AzureResourceIdentifier extends ResourceIdentifier { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AzureResourceIdentifier.class); + + /* + * ARM resource identifier for the cloud resource being alerted on + */ + @JsonProperty(value = "azureResourceId", access = JsonProperty.Access.WRITE_ONLY) + private String azureResourceId; + + /** + * Get the azureResourceId property: ARM resource identifier for the cloud resource being alerted on. + * + * @return the azureResourceId value. + */ + public String azureResourceId() { + return this.azureResourceId; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AzureResourceLink.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AzureResourceLink.java new file mode 100644 index 000000000000..89fac8a4ed32 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AzureResourceLink.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Describes an Azure resource with kind. */ +@Immutable +public final class AzureResourceLink { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AzureResourceLink.class); + + /* + * Azure resource Id + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /** + * Get the id property: Azure resource Id. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AzureTrackedResourceLocation.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AzureTrackedResourceLocation.java new file mode 100644 index 000000000000..f3dbdca38b37 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AzureTrackedResourceLocation.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Describes an Azure resource with location. */ +@Fluent +public class AzureTrackedResourceLocation { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AzureTrackedResourceLocation.class); + + /* + * Location where the resource is stored + */ + @JsonProperty(value = "location") + private String location; + + /** + * Get the location property: Location where the resource is stored. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: Location where the resource is stored. + * + * @param location the location value to set. + * @return the AzureTrackedResourceLocation object itself. + */ + public AzureTrackedResourceLocation withLocation(String location) { + this.location = location; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Baseline.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Baseline.java new file mode 100644 index 000000000000..e22225f114c7 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Baseline.java @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** Baseline details. */ +@Fluent +public final class Baseline { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Baseline.class); + + /* + * Expected results. + */ + @JsonProperty(value = "expectedResults") + private List> expectedResults; + + /* + * Baseline update time (UTC). + */ + @JsonProperty(value = "updatedTime") + private OffsetDateTime updatedTime; + + /** + * Get the expectedResults property: Expected results. + * + * @return the expectedResults value. + */ + public List> expectedResults() { + return this.expectedResults; + } + + /** + * Set the expectedResults property: Expected results. + * + * @param expectedResults the expectedResults value to set. + * @return the Baseline object itself. + */ + public Baseline withExpectedResults(List> expectedResults) { + this.expectedResults = expectedResults; + return this; + } + + /** + * Get the updatedTime property: Baseline update time (UTC). + * + * @return the updatedTime value. + */ + public OffsetDateTime updatedTime() { + return this.updatedTime; + } + + /** + * Set the updatedTime property: Baseline update time (UTC). + * + * @param updatedTime the updatedTime value to set. + * @return the Baseline object itself. + */ + public Baseline withUpdatedTime(OffsetDateTime updatedTime) { + this.updatedTime = updatedTime; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/BaselineAdjustedResult.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/BaselineAdjustedResult.java new file mode 100644 index 000000000000..f9ce9688c8aa --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/BaselineAdjustedResult.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The rule result adjusted with baseline. */ +@Fluent +public final class BaselineAdjustedResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BaselineAdjustedResult.class); + + /* + * Baseline details. + */ + @JsonProperty(value = "baseline") + private Baseline baseline; + + /* + * The rule result status. + */ + @JsonProperty(value = "status") + private RuleStatus status; + + /* + * Results the are not in baseline. + */ + @JsonProperty(value = "resultsNotInBaseline") + private List> resultsNotInBaseline; + + /* + * Results the are in baseline. + */ + @JsonProperty(value = "resultsOnlyInBaseline") + private List> resultsOnlyInBaseline; + + /** + * Get the baseline property: Baseline details. + * + * @return the baseline value. + */ + public Baseline baseline() { + return this.baseline; + } + + /** + * Set the baseline property: Baseline details. + * + * @param baseline the baseline value to set. + * @return the BaselineAdjustedResult object itself. + */ + public BaselineAdjustedResult withBaseline(Baseline baseline) { + this.baseline = baseline; + return this; + } + + /** + * Get the status property: The rule result status. + * + * @return the status value. + */ + public RuleStatus status() { + return this.status; + } + + /** + * Set the status property: The rule result status. + * + * @param status the status value to set. + * @return the BaselineAdjustedResult object itself. + */ + public BaselineAdjustedResult withStatus(RuleStatus status) { + this.status = status; + return this; + } + + /** + * Get the resultsNotInBaseline property: Results the are not in baseline. + * + * @return the resultsNotInBaseline value. + */ + public List> resultsNotInBaseline() { + return this.resultsNotInBaseline; + } + + /** + * Set the resultsNotInBaseline property: Results the are not in baseline. + * + * @param resultsNotInBaseline the resultsNotInBaseline value to set. + * @return the BaselineAdjustedResult object itself. + */ + public BaselineAdjustedResult withResultsNotInBaseline(List> resultsNotInBaseline) { + this.resultsNotInBaseline = resultsNotInBaseline; + return this; + } + + /** + * Get the resultsOnlyInBaseline property: Results the are in baseline. + * + * @return the resultsOnlyInBaseline value. + */ + public List> resultsOnlyInBaseline() { + return this.resultsOnlyInBaseline; + } + + /** + * Set the resultsOnlyInBaseline property: Results the are in baseline. + * + * @param resultsOnlyInBaseline the resultsOnlyInBaseline value to set. + * @return the BaselineAdjustedResult object itself. + */ + public BaselineAdjustedResult withResultsOnlyInBaseline(List> resultsOnlyInBaseline) { + this.resultsOnlyInBaseline = resultsOnlyInBaseline; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (baseline() != null) { + baseline().validate(); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/BenchmarkReference.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/BenchmarkReference.java new file mode 100644 index 000000000000..5cc920af08a8 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/BenchmarkReference.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The benchmark references. */ +@Fluent +public final class BenchmarkReference { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BenchmarkReference.class); + + /* + * The benchmark name. + */ + @JsonProperty(value = "benchmark") + private String benchmark; + + /* + * The benchmark reference. + */ + @JsonProperty(value = "reference") + private String reference; + + /** + * Get the benchmark property: The benchmark name. + * + * @return the benchmark value. + */ + public String benchmark() { + return this.benchmark; + } + + /** + * Set the benchmark property: The benchmark name. + * + * @param benchmark the benchmark value to set. + * @return the BenchmarkReference object itself. + */ + public BenchmarkReference withBenchmark(String benchmark) { + this.benchmark = benchmark; + return this; + } + + /** + * Get the reference property: The benchmark reference. + * + * @return the reference value. + */ + public String reference() { + return this.reference; + } + + /** + * Set the reference property: The benchmark reference. + * + * @param reference the reference value to set. + * @return the BenchmarkReference object itself. + */ + public BenchmarkReference withReference(String reference) { + this.reference = reference; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/BundleType.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/BundleType.java new file mode 100644 index 000000000000..662fcf54a310 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/BundleType.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for BundleType. */ +public final class BundleType extends ExpandableStringEnum { + /** Static value AppServices for BundleType. */ + public static final BundleType APP_SERVICES = fromString("AppServices"); + + /** Static value DNS for BundleType. */ + public static final BundleType DNS = fromString("DNS"); + + /** Static value KeyVaults for BundleType. */ + public static final BundleType KEY_VAULTS = fromString("KeyVaults"); + + /** Static value KubernetesService for BundleType. */ + public static final BundleType KUBERNETES_SERVICE = fromString("KubernetesService"); + + /** Static value ResourceManager for BundleType. */ + public static final BundleType RESOURCE_MANAGER = fromString("ResourceManager"); + + /** Static value SqlServers for BundleType. */ + public static final BundleType SQL_SERVERS = fromString("SqlServers"); + + /** Static value StorageAccounts for BundleType. */ + public static final BundleType STORAGE_ACCOUNTS = fromString("StorageAccounts"); + + /** Static value VirtualMachines for BundleType. */ + public static final BundleType VIRTUAL_MACHINES = fromString("VirtualMachines"); + + /** + * Creates or finds a BundleType from its string representation. + * + * @param name a name to look for. + * @return the corresponding BundleType. + */ + @JsonCreator + public static BundleType fromString(String name) { + return fromString(name, BundleType.class); + } + + /** @return known BundleType values. */ + public static Collection values() { + return values(BundleType.class); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Categories.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Categories.java new file mode 100644 index 000000000000..1913c067fb1b --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Categories.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for Categories. */ +public final class Categories extends ExpandableStringEnum { + /** Static value Compute for Categories. */ + public static final Categories COMPUTE = fromString("Compute"); + + /** Static value Networking for Categories. */ + public static final Categories NETWORKING = fromString("Networking"); + + /** Static value Data for Categories. */ + public static final Categories DATA = fromString("Data"); + + /** Static value IdentityAndAccess for Categories. */ + public static final Categories IDENTITY_AND_ACCESS = fromString("IdentityAndAccess"); + + /** Static value IoT for Categories. */ + public static final Categories IOT = fromString("IoT"); + + /** + * Creates or finds a Categories from its string representation. + * + * @param name a name to look for. + * @return the corresponding Categories. + */ + @JsonCreator + public static Categories fromString(String name) { + return fromString(name, Categories.class); + } + + /** @return known Categories values. */ + public static Collection values() { + return values(Categories.class); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CefExternalSecuritySolution.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CefExternalSecuritySolution.java new file mode 100644 index 000000000000..b85ba241ea79 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CefExternalSecuritySolution.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.models.ExternalSecuritySolutionInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** Represents a security solution which sends CEF logs to an OMS workspace. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "kind") +@JsonTypeName("CEF") +@Fluent +public final class CefExternalSecuritySolution extends ExternalSecuritySolutionInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CefExternalSecuritySolution.class); + + /* + * The external security solution properties for CEF solutions + */ + @JsonProperty(value = "properties") + private CefSolutionProperties properties; + + /** + * Get the properties property: The external security solution properties for CEF solutions. + * + * @return the properties value. + */ + public CefSolutionProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The external security solution properties for CEF solutions. + * + * @param properties the properties value to set. + * @return the CefExternalSecuritySolution object itself. + */ + public CefExternalSecuritySolution withProperties(CefSolutionProperties properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CefSolutionProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CefSolutionProperties.java new file mode 100644 index 000000000000..fef2b974075f --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CefSolutionProperties.java @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The external security solution properties for CEF solutions. */ +@Fluent +public final class CefSolutionProperties extends ExternalSecuritySolutionProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CefSolutionProperties.class); + + /* + * The hostname property. + */ + @JsonProperty(value = "hostname") + private String hostname; + + /* + * The agent property. + */ + @JsonProperty(value = "agent") + private String agent; + + /* + * The lastEventReceived property. + */ + @JsonProperty(value = "lastEventReceived") + private String lastEventReceived; + + /** + * Get the hostname property: The hostname property. + * + * @return the hostname value. + */ + public String hostname() { + return this.hostname; + } + + /** + * Set the hostname property: The hostname property. + * + * @param hostname the hostname value to set. + * @return the CefSolutionProperties object itself. + */ + public CefSolutionProperties withHostname(String hostname) { + this.hostname = hostname; + return this; + } + + /** + * Get the agent property: The agent property. + * + * @return the agent value. + */ + public String agent() { + return this.agent; + } + + /** + * Set the agent property: The agent property. + * + * @param agent the agent value to set. + * @return the CefSolutionProperties object itself. + */ + public CefSolutionProperties withAgent(String agent) { + this.agent = agent; + return this; + } + + /** + * Get the lastEventReceived property: The lastEventReceived property. + * + * @return the lastEventReceived value. + */ + public String lastEventReceived() { + return this.lastEventReceived; + } + + /** + * Set the lastEventReceived property: The lastEventReceived property. + * + * @param lastEventReceived the lastEventReceived value to set. + * @return the CefSolutionProperties object itself. + */ + public CefSolutionProperties withLastEventReceived(String lastEventReceived) { + this.lastEventReceived = lastEventReceived; + return this; + } + + /** {@inheritDoc} */ + @Override + public CefSolutionProperties withDeviceVendor(String deviceVendor) { + super.withDeviceVendor(deviceVendor); + return this; + } + + /** {@inheritDoc} */ + @Override + public CefSolutionProperties withDeviceType(String deviceType) { + super.withDeviceType(deviceType); + return this; + } + + /** {@inheritDoc} */ + @Override + public CefSolutionProperties withWorkspace(ConnectedWorkspace workspace) { + super.withWorkspace(workspace); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CloudErrorBody.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CloudErrorBody.java new file mode 100644 index 000000000000..145479b92b30 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CloudErrorBody.java @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The error detail. */ +@Immutable +public final class CloudErrorBody { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CloudErrorBody.class); + + /* + * The error code. + */ + @JsonProperty(value = "code", access = JsonProperty.Access.WRITE_ONLY) + private String code; + + /* + * The error message. + */ + @JsonProperty(value = "message", access = JsonProperty.Access.WRITE_ONLY) + private String message; + + /* + * The error target. + */ + @JsonProperty(value = "target", access = JsonProperty.Access.WRITE_ONLY) + private String target; + + /* + * The error details. + */ + @JsonProperty(value = "details", access = JsonProperty.Access.WRITE_ONLY) + private List details; + + /* + * The error additional info. + */ + @JsonProperty(value = "additionalInfo", access = JsonProperty.Access.WRITE_ONLY) + private List additionalInfo; + + /** + * Get the code property: The error code. + * + * @return the code value. + */ + public String code() { + return this.code; + } + + /** + * Get the message property: The error message. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * Get the target property: The error target. + * + * @return the target value. + */ + public String target() { + return this.target; + } + + /** + * Get the details property: The error details. + * + * @return the details value. + */ + public List details() { + return this.details; + } + + /** + * Get the additionalInfo property: The error additional info. + * + * @return the additionalInfo value. + */ + public List additionalInfo() { + return this.additionalInfo; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (details() != null) { + details().forEach(e -> e.validate()); + } + if (additionalInfo() != null) { + additionalInfo().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Compliance.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Compliance.java new file mode 100644 index 000000000000..7d14f9285a72 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Compliance.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.resourcemanager.security.fluent.models.ComplianceInner; +import java.time.OffsetDateTime; +import java.util.List; + +/** An immutable client-side representation of Compliance. */ +public interface Compliance { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the assessmentTimestampUtcDate property: The timestamp when the Compliance calculation was conducted. + * + * @return the assessmentTimestampUtcDate value. + */ + OffsetDateTime assessmentTimestampUtcDate(); + + /** + * Gets the resourceCount property: The resource count of the given subscription for which the Compliance + * calculation was conducted (needed for Management Group Compliance calculation). + * + * @return the resourceCount value. + */ + Integer resourceCount(); + + /** + * Gets the assessmentResult property: An array of segment, which is the actually the compliance assessment. + * + * @return the assessmentResult value. + */ + List assessmentResult(); + + /** + * Gets the inner com.azure.resourcemanager.security.fluent.models.ComplianceInner object. + * + * @return the inner object. + */ + ComplianceInner innerModel(); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ComplianceList.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ComplianceList.java new file mode 100644 index 000000000000..3923e1f7a5ee --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ComplianceList.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.models.ComplianceInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of Compliance objects response. */ +@Fluent +public final class ComplianceList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ComplianceList.class); + + /* + * List of Compliance objects + */ + @JsonProperty(value = "value") + private List value; + + /* + * The URI to fetch the next page. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: List of Compliance objects. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: List of Compliance objects. + * + * @param value the value value to set. + * @return the ComplianceList object itself. + */ + public ComplianceList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The URI to fetch the next page. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ComplianceResult.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ComplianceResult.java new file mode 100644 index 000000000000..a762e476d259 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ComplianceResult.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.resourcemanager.security.fluent.models.ComplianceResultInner; + +/** An immutable client-side representation of ComplianceResult. */ +public interface ComplianceResult { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the resourceStatus property: The status of the resource regarding a single assessment. + * + * @return the resourceStatus value. + */ + ResourceStatus resourceStatus(); + + /** + * Gets the inner com.azure.resourcemanager.security.fluent.models.ComplianceResultInner object. + * + * @return the inner object. + */ + ComplianceResultInner innerModel(); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ComplianceResultList.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ComplianceResultList.java new file mode 100644 index 000000000000..72fc3d8e94a1 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ComplianceResultList.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.models.ComplianceResultInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of compliance results response. */ +@Fluent +public final class ComplianceResultList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ComplianceResultList.class); + + /* + * List of compliance results + */ + @JsonProperty(value = "value", required = true) + private List value; + + /* + * The URI to fetch the next page. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: List of compliance results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: List of compliance results. + * + * @param value the value value to set. + * @return the ComplianceResultList object itself. + */ + public ComplianceResultList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The URI to fetch the next page. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property value in model ComplianceResultList")); + } else { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ComplianceResults.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ComplianceResults.java new file mode 100644 index 000000000000..861658b2d6f3 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ComplianceResults.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of ComplianceResults. */ +public interface ComplianceResults { + /** + * Security compliance results in the subscription. + * + * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of compliance results response. + */ + PagedIterable list(String scope); + + /** + * Security compliance results in the subscription. + * + * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of compliance results response. + */ + PagedIterable list(String scope, Context context); + + /** + * Security Compliance Result. + * + * @param resourceId The identifier of the resource. + * @param complianceResultName name of the desired assessment compliance result. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a compliance result. + */ + ComplianceResult get(String resourceId, String complianceResultName); + + /** + * Security Compliance Result. + * + * @param resourceId The identifier of the resource. + * @param complianceResultName name of the desired assessment compliance result. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a compliance result. + */ + Response getWithResponse(String resourceId, String complianceResultName, Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ComplianceSegment.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ComplianceSegment.java new file mode 100644 index 000000000000..74e3a5413762 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ComplianceSegment.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A segment of a compliance assessment. */ +@Immutable +public final class ComplianceSegment { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ComplianceSegment.class); + + /* + * The segment type, e.g. compliant, non-compliance, insufficient coverage, + * N/A, etc. + */ + @JsonProperty(value = "segmentType", access = JsonProperty.Access.WRITE_ONLY) + private String segmentType; + + /* + * The size (%) of the segment. + */ + @JsonProperty(value = "percentage", access = JsonProperty.Access.WRITE_ONLY) + private Double percentage; + + /** + * Get the segmentType property: The segment type, e.g. compliant, non-compliance, insufficient coverage, N/A, etc. + * + * @return the segmentType value. + */ + public String segmentType() { + return this.segmentType; + } + + /** + * Get the percentage property: The size (%) of the segment. + * + * @return the percentage value. + */ + public Double percentage() { + return this.percentage; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Compliances.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Compliances.java new file mode 100644 index 000000000000..15cddd09351e --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Compliances.java @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of Compliances. */ +public interface Compliances { + /** + * The Compliance scores of the specific management group. + * + * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Compliance objects response. + */ + PagedIterable list(String scope); + + /** + * The Compliance scores of the specific management group. + * + * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Compliance objects response. + */ + PagedIterable list(String scope, Context context); + + /** + * Details of a specific Compliance. + * + * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @param complianceName name of the Compliance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return compliance of a scope. + */ + Compliance get(String scope, String complianceName); + + /** + * Details of a specific Compliance. + * + * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @param complianceName name of the Compliance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return compliance of a scope. + */ + Response getWithResponse(String scope, String complianceName, Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ConfigurationStatus.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ConfigurationStatus.java new file mode 100644 index 000000000000..645af849460e --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ConfigurationStatus.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ConfigurationStatus. */ +public final class ConfigurationStatus extends ExpandableStringEnum { + /** Static value Configured for ConfigurationStatus. */ + public static final ConfigurationStatus CONFIGURED = fromString("Configured"); + + /** Static value NotConfigured for ConfigurationStatus. */ + public static final ConfigurationStatus NOT_CONFIGURED = fromString("NotConfigured"); + + /** Static value InProgress for ConfigurationStatus. */ + public static final ConfigurationStatus IN_PROGRESS = fromString("InProgress"); + + /** Static value Failed for ConfigurationStatus. */ + public static final ConfigurationStatus FAILED = fromString("Failed"); + + /** Static value NoStatus for ConfigurationStatus. */ + public static final ConfigurationStatus NO_STATUS = fromString("NoStatus"); + + /** + * Creates or finds a ConfigurationStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding ConfigurationStatus. + */ + @JsonCreator + public static ConfigurationStatus fromString(String name) { + return fromString(name, ConfigurationStatus.class); + } + + /** @return known ConfigurationStatus values. */ + public static Collection values() { + return values(ConfigurationStatus.class); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ConnectableResource.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ConnectableResource.java new file mode 100644 index 000000000000..fe34960dd9d8 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ConnectableResource.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Describes the allowed inbound and outbound traffic of an Azure resource. */ +@Immutable +public final class ConnectableResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ConnectableResource.class); + + /* + * The Azure resource id + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /* + * The list of Azure resources that the resource has inbound allowed + * connection from + */ + @JsonProperty(value = "inboundConnectedResources", access = JsonProperty.Access.WRITE_ONLY) + private List inboundConnectedResources; + + /* + * The list of Azure resources that the resource has outbound allowed + * connection to + */ + @JsonProperty(value = "outboundConnectedResources", access = JsonProperty.Access.WRITE_ONLY) + private List outboundConnectedResources; + + /** + * Get the id property: The Azure resource id. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Get the inboundConnectedResources property: The list of Azure resources that the resource has inbound allowed + * connection from. + * + * @return the inboundConnectedResources value. + */ + public List inboundConnectedResources() { + return this.inboundConnectedResources; + } + + /** + * Get the outboundConnectedResources property: The list of Azure resources that the resource has outbound allowed + * connection to. + * + * @return the outboundConnectedResources value. + */ + public List outboundConnectedResources() { + return this.outboundConnectedResources; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (inboundConnectedResources() != null) { + inboundConnectedResources().forEach(e -> e.validate()); + } + if (outboundConnectedResources() != null) { + outboundConnectedResources().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ConnectedResource.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ConnectedResource.java new file mode 100644 index 000000000000..f749c3401ae0 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ConnectedResource.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Describes properties of a connected resource. */ +@Immutable +public final class ConnectedResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ConnectedResource.class); + + /* + * The Azure resource id of the connected resource + */ + @JsonProperty(value = "connectedResourceId", access = JsonProperty.Access.WRITE_ONLY) + private String connectedResourceId; + + /* + * The allowed tcp ports + */ + @JsonProperty(value = "tcpPorts", access = JsonProperty.Access.WRITE_ONLY) + private String tcpPorts; + + /* + * The allowed udp ports + */ + @JsonProperty(value = "udpPorts", access = JsonProperty.Access.WRITE_ONLY) + private String udpPorts; + + /** + * Get the connectedResourceId property: The Azure resource id of the connected resource. + * + * @return the connectedResourceId value. + */ + public String connectedResourceId() { + return this.connectedResourceId; + } + + /** + * Get the tcpPorts property: The allowed tcp ports. + * + * @return the tcpPorts value. + */ + public String tcpPorts() { + return this.tcpPorts; + } + + /** + * Get the udpPorts property: The allowed udp ports. + * + * @return the udpPorts value. + */ + public String udpPorts() { + return this.udpPorts; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ConnectedWorkspace.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ConnectedWorkspace.java new file mode 100644 index 000000000000..5f2e3fc97748 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ConnectedWorkspace.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Represents an OMS workspace to which the solution is connected. */ +@Fluent +public final class ConnectedWorkspace { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ConnectedWorkspace.class); + + /* + * Azure resource ID of the connected OMS workspace + */ + @JsonProperty(value = "id") + private String id; + + /** + * Get the id property: Azure resource ID of the connected OMS workspace. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: Azure resource ID of the connected OMS workspace. + * + * @param id the id value to set. + * @return the ConnectedWorkspace object itself. + */ + public ConnectedWorkspace withId(String id) { + this.id = id; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ConnectionFromIpNotAllowed.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ConnectionFromIpNotAllowed.java new file mode 100644 index 000000000000..b2b6137577a1 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ConnectionFromIpNotAllowed.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.util.List; + +/** Inbound connection from an ip that isn't allowed. Allow list consists of ipv4 or ipv6 range in CIDR notation. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "ruleType") +@JsonTypeName("ConnectionFromIpNotAllowed") +@Fluent +public final class ConnectionFromIpNotAllowed extends AllowlistCustomAlertRule { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ConnectionFromIpNotAllowed.class); + + /** {@inheritDoc} */ + @Override + public ConnectionFromIpNotAllowed withAllowlistValues(List allowlistValues) { + super.withAllowlistValues(allowlistValues); + return this; + } + + /** {@inheritDoc} */ + @Override + public ConnectionFromIpNotAllowed withIsEnabled(boolean isEnabled) { + super.withIsEnabled(isEnabled); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ConnectionStrings.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ConnectionStrings.java new file mode 100644 index 000000000000..c5da6b30ddaf --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ConnectionStrings.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.resourcemanager.security.fluent.models.ConnectionStringsInner; +import java.util.List; + +/** An immutable client-side representation of ConnectionStrings. */ +public interface ConnectionStrings { + /** + * Gets the value property: Connection strings. + * + * @return the value value. + */ + List value(); + + /** + * Gets the inner com.azure.resourcemanager.security.fluent.models.ConnectionStringsInner object. + * + * @return the inner object. + */ + ConnectionStringsInner innerModel(); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ConnectionToIpNotAllowed.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ConnectionToIpNotAllowed.java new file mode 100644 index 000000000000..749e49e40c55 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ConnectionToIpNotAllowed.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.util.List; + +/** Outbound connection to an ip that isn't allowed. Allow list consists of ipv4 or ipv6 range in CIDR notation. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "ruleType") +@JsonTypeName("ConnectionToIpNotAllowed") +@Fluent +public final class ConnectionToIpNotAllowed extends AllowlistCustomAlertRule { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ConnectionToIpNotAllowed.class); + + /** {@inheritDoc} */ + @Override + public ConnectionToIpNotAllowed withAllowlistValues(List allowlistValues) { + super.withAllowlistValues(allowlistValues); + return this; + } + + /** {@inheritDoc} */ + @Override + public ConnectionToIpNotAllowed withIsEnabled(boolean isEnabled) { + super.withIsEnabled(isEnabled); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ConnectionType.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ConnectionType.java new file mode 100644 index 000000000000..616693959a36 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ConnectionType.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ConnectionType. */ +public final class ConnectionType extends ExpandableStringEnum { + /** Static value Internal for ConnectionType. */ + public static final ConnectionType INTERNAL = fromString("Internal"); + + /** Static value External for ConnectionType. */ + public static final ConnectionType EXTERNAL = fromString("External"); + + /** + * Creates or finds a ConnectionType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ConnectionType. + */ + @JsonCreator + public static ConnectionType fromString(String name) { + return fromString(name, ConnectionType.class); + } + + /** @return known ConnectionType values. */ + public static Collection values() { + return values(ConnectionType.class); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ConnectorSetting.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ConnectorSetting.java new file mode 100644 index 000000000000..5a13750d1686 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ConnectorSetting.java @@ -0,0 +1,175 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.ConnectorSettingInner; + +/** An immutable client-side representation of ConnectorSetting. */ +public interface ConnectorSetting { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the hybridComputeSettings property: Settings for hybrid compute management. These settings are relevant only + * for Arc autoProvision (Hybrid Compute). + * + * @return the hybridComputeSettings value. + */ + HybridComputeSettingsProperties hybridComputeSettings(); + + /** + * Gets the authenticationDetails property: Settings for authentication management, these settings are relevant only + * for the cloud connector. + * + * @return the authenticationDetails value. + */ + AuthenticationDetailsProperties authenticationDetails(); + + /** + * Gets the inner com.azure.resourcemanager.security.fluent.models.ConnectorSettingInner object. + * + * @return the inner object. + */ + ConnectorSettingInner innerModel(); + + /** The entirety of the ConnectorSetting definition. */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithCreate { + } + /** The ConnectorSetting definition stages. */ + interface DefinitionStages { + /** The first stage of the ConnectorSetting definition. */ + interface Blank extends WithCreate { + } + /** + * The stage of the ConnectorSetting definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithHybridComputeSettings, DefinitionStages.WithAuthenticationDetails { + /** + * Executes the create request. + * + * @return the created resource. + */ + ConnectorSetting create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ConnectorSetting create(Context context); + } + /** The stage of the ConnectorSetting definition allowing to specify hybridComputeSettings. */ + interface WithHybridComputeSettings { + /** + * Specifies the hybridComputeSettings property: Settings for hybrid compute management. These settings are + * relevant only for Arc autoProvision (Hybrid Compute).. + * + * @param hybridComputeSettings Settings for hybrid compute management. These settings are relevant only for + * Arc autoProvision (Hybrid Compute). + * @return the next definition stage. + */ + WithCreate withHybridComputeSettings(HybridComputeSettingsProperties hybridComputeSettings); + } + /** The stage of the ConnectorSetting definition allowing to specify authenticationDetails. */ + interface WithAuthenticationDetails { + /** + * Specifies the authenticationDetails property: Settings for authentication management, these settings are + * relevant only for the cloud connector.. + * + * @param authenticationDetails Settings for authentication management, these settings are relevant only for + * the cloud connector. + * @return the next definition stage. + */ + WithCreate withAuthenticationDetails(AuthenticationDetailsProperties authenticationDetails); + } + } + /** + * Begins update for the ConnectorSetting resource. + * + * @return the stage of resource update. + */ + ConnectorSetting.Update update(); + + /** The template for ConnectorSetting update. */ + interface Update extends UpdateStages.WithHybridComputeSettings, UpdateStages.WithAuthenticationDetails { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ConnectorSetting apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ConnectorSetting apply(Context context); + } + /** The ConnectorSetting update stages. */ + interface UpdateStages { + /** The stage of the ConnectorSetting update allowing to specify hybridComputeSettings. */ + interface WithHybridComputeSettings { + /** + * Specifies the hybridComputeSettings property: Settings for hybrid compute management. These settings are + * relevant only for Arc autoProvision (Hybrid Compute).. + * + * @param hybridComputeSettings Settings for hybrid compute management. These settings are relevant only for + * Arc autoProvision (Hybrid Compute). + * @return the next definition stage. + */ + Update withHybridComputeSettings(HybridComputeSettingsProperties hybridComputeSettings); + } + /** The stage of the ConnectorSetting update allowing to specify authenticationDetails. */ + interface WithAuthenticationDetails { + /** + * Specifies the authenticationDetails property: Settings for authentication management, these settings are + * relevant only for the cloud connector.. + * + * @param authenticationDetails Settings for authentication management, these settings are relevant only for + * the cloud connector. + * @return the next definition stage. + */ + Update withAuthenticationDetails(AuthenticationDetailsProperties authenticationDetails); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ConnectorSetting refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ConnectorSetting refresh(Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ConnectorSettingList.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ConnectorSettingList.java new file mode 100644 index 000000000000..61ed31afdaa7 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ConnectorSettingList.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.models.ConnectorSettingInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** For a subscription, list of all cloud account connectors and their settings. */ +@Fluent +public final class ConnectorSettingList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ConnectorSettingList.class); + + /* + * List of all the cloud account connector settings + */ + @JsonProperty(value = "value") + private List value; + + /* + * The URI to fetch the next page. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: List of all the cloud account connector settings. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: List of all the cloud account connector settings. + * + * @param value the value value to set. + * @return the ConnectorSettingList object itself. + */ + public ConnectorSettingList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The URI to fetch the next page. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Connectors.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Connectors.java new file mode 100644 index 000000000000..b8a1a16babcc --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Connectors.java @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of Connectors. */ +public interface Connectors { + /** + * Cloud accounts connectors of a subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return for a subscription, list of all cloud account connectors and their settings. + */ + PagedIterable list(); + + /** + * Cloud accounts connectors of a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return for a subscription, list of all cloud account connectors and their settings. + */ + PagedIterable list(Context context); + + /** + * Details of a specific cloud account connector. + * + * @param connectorName Name of the cloud account connector. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the connector setting. + */ + ConnectorSetting get(String connectorName); + + /** + * Details of a specific cloud account connector. + * + * @param connectorName Name of the cloud account connector. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the connector setting. + */ + Response getWithResponse(String connectorName, Context context); + + /** + * Delete a cloud account connector from a subscription. + * + * @param connectorName Name of the cloud account connector. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String connectorName); + + /** + * Delete a cloud account connector from a subscription. + * + * @param connectorName Name of the cloud account connector. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response deleteWithResponse(String connectorName, Context context); + + /** + * Details of a specific cloud account connector. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the connector setting. + */ + ConnectorSetting getById(String id); + + /** + * Details of a specific cloud account connector. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the connector setting. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete a cloud account connector from a subscription. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Delete a cloud account connector from a subscription. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new ConnectorSetting resource. + * + * @param name resource name. + * @return the first stage of the new ConnectorSetting definition. + */ + ConnectorSetting.DefinitionStages.Blank define(String name); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ContainerRegistryVulnerabilityProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ContainerRegistryVulnerabilityProperties.java new file mode 100644 index 000000000000..f55e74444075 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ContainerRegistryVulnerabilityProperties.java @@ -0,0 +1,171 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; + +/** Additional context fields for container registry Vulnerability assessment. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "assessedResourceType") +@JsonTypeName("ContainerRegistryVulnerability") +@Immutable +public final class ContainerRegistryVulnerabilityProperties extends AdditionalData { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ContainerRegistryVulnerabilityProperties.class); + + /* + * Vulnerability Type. e.g: Vulnerability, Potential Vulnerability, + * Information Gathered, Vulnerability + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /* + * Dictionary from cvss version to cvss details object + */ + @JsonProperty(value = "cvss", access = JsonProperty.Access.WRITE_ONLY) + private Map cvss; + + /* + * Indicates whether a patch is available or not + */ + @JsonProperty(value = "patchable", access = JsonProperty.Access.WRITE_ONLY) + private Boolean patchable; + + /* + * List of CVEs + */ + @JsonProperty(value = "cve", access = JsonProperty.Access.WRITE_ONLY) + private List cve; + + /* + * Published time + */ + @JsonProperty(value = "publishedTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime publishedTime; + + /* + * The vendorReferences property. + */ + @JsonProperty(value = "vendorReferences", access = JsonProperty.Access.WRITE_ONLY) + private List vendorReferences; + + /* + * Name of the repository which the vulnerable image belongs to + */ + @JsonProperty(value = "repositoryName", access = JsonProperty.Access.WRITE_ONLY) + private String repositoryName; + + /* + * Digest of the vulnerable image + */ + @JsonProperty(value = "imageDigest", access = JsonProperty.Access.WRITE_ONLY) + private String imageDigest; + + /** + * Get the type property: Vulnerability Type. e.g: Vulnerability, Potential Vulnerability, Information Gathered, + * Vulnerability. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Get the cvss property: Dictionary from cvss version to cvss details object. + * + * @return the cvss value. + */ + public Map cvss() { + return this.cvss; + } + + /** + * Get the patchable property: Indicates whether a patch is available or not. + * + * @return the patchable value. + */ + public Boolean patchable() { + return this.patchable; + } + + /** + * Get the cve property: List of CVEs. + * + * @return the cve value. + */ + public List cve() { + return this.cve; + } + + /** + * Get the publishedTime property: Published time. + * + * @return the publishedTime value. + */ + public OffsetDateTime publishedTime() { + return this.publishedTime; + } + + /** + * Get the vendorReferences property: The vendorReferences property. + * + * @return the vendorReferences value. + */ + public List vendorReferences() { + return this.vendorReferences; + } + + /** + * Get the repositoryName property: Name of the repository which the vulnerable image belongs to. + * + * @return the repositoryName value. + */ + public String repositoryName() { + return this.repositoryName; + } + + /** + * Get the imageDigest property: Digest of the vulnerable image. + * + * @return the imageDigest value. + */ + public String imageDigest() { + return this.imageDigest; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (cvss() != null) { + cvss() + .values() + .forEach( + e -> { + if (e != null) { + e.validate(); + } + }); + } + if (cve() != null) { + cve().forEach(e -> e.validate()); + } + if (vendorReferences() != null) { + vendorReferences().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ControlType.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ControlType.java new file mode 100644 index 000000000000..6a48e6792c30 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ControlType.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ControlType. */ +public final class ControlType extends ExpandableStringEnum { + /** Static value BuiltIn for ControlType. */ + public static final ControlType BUILT_IN = fromString("BuiltIn"); + + /** Static value Custom for ControlType. */ + public static final ControlType CUSTOM = fromString("Custom"); + + /** + * Creates or finds a ControlType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ControlType. + */ + @JsonCreator + public static ControlType fromString(String name) { + return fromString(name, ControlType.class); + } + + /** @return known ControlType values. */ + public static Collection values() { + return values(ControlType.class); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CustomAlertRule.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CustomAlertRule.java new file mode 100644 index 000000000000..95127016172d --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CustomAlertRule.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** A custom alert rule. */ +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "ruleType", + defaultImpl = CustomAlertRule.class) +@JsonTypeName("CustomAlertRule") +@JsonSubTypes({ + @JsonSubTypes.Type(name = "ThresholdCustomAlertRule", value = ThresholdCustomAlertRule.class), + @JsonSubTypes.Type(name = "ListCustomAlertRule", value = ListCustomAlertRule.class) +}) +@Fluent +public class CustomAlertRule { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CustomAlertRule.class); + + /* + * The display name of the custom alert. + */ + @JsonProperty(value = "displayName", access = JsonProperty.Access.WRITE_ONLY) + private String displayName; + + /* + * The description of the custom alert. + */ + @JsonProperty(value = "description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /* + * Status of the custom alert. + */ + @JsonProperty(value = "isEnabled", required = true) + private boolean isEnabled; + + /** + * Get the displayName property: The display name of the custom alert. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Get the description property: The description of the custom alert. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Get the isEnabled property: Status of the custom alert. + * + * @return the isEnabled value. + */ + public boolean isEnabled() { + return this.isEnabled; + } + + /** + * Set the isEnabled property: Status of the custom alert. + * + * @param isEnabled the isEnabled value to set. + * @return the CustomAlertRule object itself. + */ + public CustomAlertRule withIsEnabled(boolean isEnabled) { + this.isEnabled = isEnabled; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Cve.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Cve.java new file mode 100644 index 000000000000..ce0abdc4a339 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Cve.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** CVE details. */ +@Immutable +public final class Cve { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Cve.class); + + /* + * CVE title + */ + @JsonProperty(value = "title", access = JsonProperty.Access.WRITE_ONLY) + private String title; + + /* + * Link url + */ + @JsonProperty(value = "link", access = JsonProperty.Access.WRITE_ONLY) + private String link; + + /** + * Get the title property: CVE title. + * + * @return the title value. + */ + public String title() { + return this.title; + } + + /** + * Get the link property: Link url. + * + * @return the link value. + */ + public String link() { + return this.link; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Cvss.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Cvss.java new file mode 100644 index 000000000000..9b93bb1a9f0b --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Cvss.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** CVSS details. */ +@Immutable +public final class Cvss { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Cvss.class); + + /* + * CVSS base + */ + @JsonProperty(value = "base", access = JsonProperty.Access.WRITE_ONLY) + private Float base; + + /** + * Get the base property: CVSS base. + * + * @return the base value. + */ + public Float base() { + return this.base; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DataExportSettings.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DataExportSettings.java new file mode 100644 index 000000000000..19d6438d68b0 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DataExportSettings.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.models.SettingInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** Represents a data export setting. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "kind") +@JsonTypeName("DataExportSettings") +@JsonFlatten +@Fluent +public class DataExportSettings extends SettingInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DataExportSettings.class); + + /* + * Is the data export setting enabled + */ + @JsonProperty(value = "properties.enabled") + private Boolean enabled; + + /** + * Get the enabled property: Is the data export setting enabled. + * + * @return the enabled value. + */ + public Boolean enabled() { + return this.enabled; + } + + /** + * Set the enabled property: Is the data export setting enabled. + * + * @param enabled the enabled value to set. + * @return the DataExportSettings object itself. + */ + public DataExportSettings withEnabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DataSource.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DataSource.java new file mode 100644 index 000000000000..4e0a97df6556 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DataSource.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for DataSource. */ +public final class DataSource extends ExpandableStringEnum { + /** Static value TwinData for DataSource. */ + public static final DataSource TWIN_DATA = fromString("TwinData"); + + /** + * Creates or finds a DataSource from its string representation. + * + * @param name a name to look for. + * @return the corresponding DataSource. + */ + @JsonCreator + public static DataSource fromString(String name) { + return fromString(name, DataSource.class); + } + + /** @return known DataSource values. */ + public static Collection values() { + return values(DataSource.class); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DenylistCustomAlertRule.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DenylistCustomAlertRule.java new file mode 100644 index 000000000000..8877e5b8717f --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DenylistCustomAlertRule.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.util.List; + +/** A custom alert rule that checks if a value (depends on the custom alert type) is denied. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "ruleType") +@JsonTypeName("DenylistCustomAlertRule") +@Fluent +public final class DenylistCustomAlertRule extends ListCustomAlertRule { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DenylistCustomAlertRule.class); + + /* + * The values to deny. The format of the values depends on the rule type. + */ + @JsonProperty(value = "denylistValues", required = true) + private List denylistValues; + + /** + * Get the denylistValues property: The values to deny. The format of the values depends on the rule type. + * + * @return the denylistValues value. + */ + public List denylistValues() { + return this.denylistValues; + } + + /** + * Set the denylistValues property: The values to deny. The format of the values depends on the rule type. + * + * @param denylistValues the denylistValues value to set. + * @return the DenylistCustomAlertRule object itself. + */ + public DenylistCustomAlertRule withDenylistValues(List denylistValues) { + this.denylistValues = denylistValues; + return this; + } + + /** {@inheritDoc} */ + @Override + public DenylistCustomAlertRule withIsEnabled(boolean isEnabled) { + super.withIsEnabled(isEnabled); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (denylistValues() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property denylistValues in model DenylistCustomAlertRule")); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Device.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Device.java new file mode 100644 index 000000000000..71d5333cfed3 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Device.java @@ -0,0 +1,208 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.resourcemanager.security.fluent.models.DeviceInner; +import java.time.OffsetDateTime; +import java.util.List; + +/** An immutable client-side representation of Device. */ +public interface Device { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the displayName property: Device display name given by the collector. + * + * @return the displayName value. + */ + String displayName(); + + /** + * Gets the deviceType property: Device type. + * + * @return the deviceType value. + */ + String deviceType(); + + /** + * Gets the sourceName property: The source that created the device. + * + * @return the sourceName value. + */ + String sourceName(); + + /** + * Gets the networkInterfaces property: List of network interfaces. + * + * @return the networkInterfaces value. + */ + List networkInterfaces(); + + /** + * Gets the vendor property: Device vendor. + * + * @return the vendor value. + */ + String vendor(); + + /** + * Gets the osName property: Device operating system name. + * + * @return the osName value. + */ + String osName(); + + /** + * Gets the protocols property: List of protocols. + * + * @return the protocols value. + */ + List protocols(); + + /** + * Gets the lastActiveTime property: last time the device was active in the network. + * + * @return the lastActiveTime value. + */ + OffsetDateTime lastActiveTime(); + + /** + * Gets the lastUpdateTime property: last time the device was updated. + * + * @return the lastUpdateTime value. + */ + OffsetDateTime lastUpdateTime(); + + /** + * Gets the managementState property: Managed state of the device. + * + * @return the managementState value. + */ + ManagementState managementState(); + + /** + * Gets the authorizationState property: Authorized state of the device. + * + * @return the authorizationState value. + */ + AuthorizationState authorizationState(); + + /** + * Gets the deviceCriticality property: Device criticality. + * + * @return the deviceCriticality value. + */ + DeviceCriticality deviceCriticality(); + + /** + * Gets the purdueLevel property: Purdue level of the device. + * + * @return the purdueLevel value. + */ + PurdueLevel purdueLevel(); + + /** + * Gets the notes property: user notes for the device, up to 300 characters. + * + * @return the notes value. + */ + String notes(); + + /** + * Gets the firmwares property: List of device firmwares. + * + * @return the firmwares value. + */ + List firmwares(); + + /** + * Gets the discoveryTime property: Discovered time of the device. + * + * @return the discoveryTime value. + */ + OffsetDateTime discoveryTime(); + + /** + * Gets the programmingState property: Indicates whether this device is programming. + * + * @return the programmingState value. + */ + ProgrammingState programmingState(); + + /** + * Gets the lastProgrammingTime property: last time the device was programming or programed. + * + * @return the lastProgrammingTime value. + */ + OffsetDateTime lastProgrammingTime(); + + /** + * Gets the scanningFunctionality property: Indicates whether the device is a scanner. + * + * @return the scanningFunctionality value. + */ + ScanningFunctionality scanningFunctionality(); + + /** + * Gets the lastScanTime property: last time the device was scanning. + * + * @return the lastScanTime value. + */ + OffsetDateTime lastScanTime(); + + /** + * Gets the riskScore property: risk score of the device. + * + * @return the riskScore value. + */ + Integer riskScore(); + + /** + * Gets the sensors property: List of sensors that scanned this device. + * + * @return the sensors value. + */ + List sensors(); + + /** + * Gets the site property: Site data. + * + * @return the site value. + */ + Site site(); + + /** + * Gets the deviceStatus property: Device status. + * + * @return the deviceStatus value. + */ + DeviceStatus deviceStatus(); + + /** + * Gets the inner com.azure.resourcemanager.security.fluent.models.DeviceInner object. + * + * @return the inner object. + */ + DeviceInner innerModel(); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DeviceCriticality.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DeviceCriticality.java new file mode 100644 index 000000000000..0ad8a0d59c09 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DeviceCriticality.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for DeviceCriticality. */ +public final class DeviceCriticality extends ExpandableStringEnum { + /** Static value Important for DeviceCriticality. */ + public static final DeviceCriticality IMPORTANT = fromString("Important"); + + /** Static value Standard for DeviceCriticality. */ + public static final DeviceCriticality STANDARD = fromString("Standard"); + + /** + * Creates or finds a DeviceCriticality from its string representation. + * + * @param name a name to look for. + * @return the corresponding DeviceCriticality. + */ + @JsonCreator + public static DeviceCriticality fromString(String name) { + return fromString(name, DeviceCriticality.class); + } + + /** @return known DeviceCriticality values. */ + public static Collection values() { + return values(DeviceCriticality.class); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DeviceList.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DeviceList.java new file mode 100644 index 000000000000..24fd4db7ce11 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DeviceList.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.models.DeviceInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of Devices. */ +@Fluent +public final class DeviceList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DeviceList.class); + + /* + * List of devices + */ + @JsonProperty(value = "value", required = true) + private List value; + + /* + * When there are too many devices for one page, use this URI to fetch the + * next page. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: List of devices. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: List of devices. + * + * @param value the value value to set. + * @return the DeviceList object itself. + */ + public DeviceList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: When there are too many devices for one page, use this URI to fetch the next page. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property value in model DeviceList")); + } else { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DeviceSecurityGroup.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DeviceSecurityGroup.java new file mode 100644 index 000000000000..8cf36f7d77a0 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DeviceSecurityGroup.java @@ -0,0 +1,237 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.DeviceSecurityGroupInner; +import java.util.List; + +/** An immutable client-side representation of DeviceSecurityGroup. */ +public interface DeviceSecurityGroup { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the thresholdRules property: The list of custom alert threshold rules. + * + * @return the thresholdRules value. + */ + List thresholdRules(); + + /** + * Gets the timeWindowRules property: The list of custom alert time-window rules. + * + * @return the timeWindowRules value. + */ + List timeWindowRules(); + + /** + * Gets the allowlistRules property: The allow-list custom alert rules. + * + * @return the allowlistRules value. + */ + List allowlistRules(); + + /** + * Gets the denylistRules property: The deny-list custom alert rules. + * + * @return the denylistRules value. + */ + List denylistRules(); + + /** + * Gets the inner com.azure.resourcemanager.security.fluent.models.DeviceSecurityGroupInner object. + * + * @return the inner object. + */ + DeviceSecurityGroupInner innerModel(); + + /** The entirety of the DeviceSecurityGroup definition. */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithScope, DefinitionStages.WithCreate { + } + /** The DeviceSecurityGroup definition stages. */ + interface DefinitionStages { + /** The first stage of the DeviceSecurityGroup definition. */ + interface Blank extends WithScope { + } + /** The stage of the DeviceSecurityGroup definition allowing to specify parent resource. */ + interface WithScope { + /** + * Specifies resourceId. + * + * @param resourceId The identifier of the resource. + * @return the next definition stage. + */ + WithCreate withExistingResourceId(String resourceId); + } + /** + * The stage of the DeviceSecurityGroup definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithThresholdRules, + DefinitionStages.WithTimeWindowRules, + DefinitionStages.WithAllowlistRules, + DefinitionStages.WithDenylistRules { + /** + * Executes the create request. + * + * @return the created resource. + */ + DeviceSecurityGroup create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + DeviceSecurityGroup create(Context context); + } + /** The stage of the DeviceSecurityGroup definition allowing to specify thresholdRules. */ + interface WithThresholdRules { + /** + * Specifies the thresholdRules property: The list of custom alert threshold rules.. + * + * @param thresholdRules The list of custom alert threshold rules. + * @return the next definition stage. + */ + WithCreate withThresholdRules(List thresholdRules); + } + /** The stage of the DeviceSecurityGroup definition allowing to specify timeWindowRules. */ + interface WithTimeWindowRules { + /** + * Specifies the timeWindowRules property: The list of custom alert time-window rules.. + * + * @param timeWindowRules The list of custom alert time-window rules. + * @return the next definition stage. + */ + WithCreate withTimeWindowRules(List timeWindowRules); + } + /** The stage of the DeviceSecurityGroup definition allowing to specify allowlistRules. */ + interface WithAllowlistRules { + /** + * Specifies the allowlistRules property: The allow-list custom alert rules.. + * + * @param allowlistRules The allow-list custom alert rules. + * @return the next definition stage. + */ + WithCreate withAllowlistRules(List allowlistRules); + } + /** The stage of the DeviceSecurityGroup definition allowing to specify denylistRules. */ + interface WithDenylistRules { + /** + * Specifies the denylistRules property: The deny-list custom alert rules.. + * + * @param denylistRules The deny-list custom alert rules. + * @return the next definition stage. + */ + WithCreate withDenylistRules(List denylistRules); + } + } + /** + * Begins update for the DeviceSecurityGroup resource. + * + * @return the stage of resource update. + */ + DeviceSecurityGroup.Update update(); + + /** The template for DeviceSecurityGroup update. */ + interface Update + extends UpdateStages.WithThresholdRules, + UpdateStages.WithTimeWindowRules, + UpdateStages.WithAllowlistRules, + UpdateStages.WithDenylistRules { + /** + * Executes the update request. + * + * @return the updated resource. + */ + DeviceSecurityGroup apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + DeviceSecurityGroup apply(Context context); + } + /** The DeviceSecurityGroup update stages. */ + interface UpdateStages { + /** The stage of the DeviceSecurityGroup update allowing to specify thresholdRules. */ + interface WithThresholdRules { + /** + * Specifies the thresholdRules property: The list of custom alert threshold rules.. + * + * @param thresholdRules The list of custom alert threshold rules. + * @return the next definition stage. + */ + Update withThresholdRules(List thresholdRules); + } + /** The stage of the DeviceSecurityGroup update allowing to specify timeWindowRules. */ + interface WithTimeWindowRules { + /** + * Specifies the timeWindowRules property: The list of custom alert time-window rules.. + * + * @param timeWindowRules The list of custom alert time-window rules. + * @return the next definition stage. + */ + Update withTimeWindowRules(List timeWindowRules); + } + /** The stage of the DeviceSecurityGroup update allowing to specify allowlistRules. */ + interface WithAllowlistRules { + /** + * Specifies the allowlistRules property: The allow-list custom alert rules.. + * + * @param allowlistRules The allow-list custom alert rules. + * @return the next definition stage. + */ + Update withAllowlistRules(List allowlistRules); + } + /** The stage of the DeviceSecurityGroup update allowing to specify denylistRules. */ + interface WithDenylistRules { + /** + * Specifies the denylistRules property: The deny-list custom alert rules.. + * + * @param denylistRules The deny-list custom alert rules. + * @return the next definition stage. + */ + Update withDenylistRules(List denylistRules); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + DeviceSecurityGroup refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + DeviceSecurityGroup refresh(Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DeviceSecurityGroupList.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DeviceSecurityGroupList.java new file mode 100644 index 000000000000..e32b8231f59f --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DeviceSecurityGroupList.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.models.DeviceSecurityGroupInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of device security groups. */ +@Fluent +public final class DeviceSecurityGroupList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DeviceSecurityGroupList.class); + + /* + * List of device security group objects + */ + @JsonProperty(value = "value") + private List value; + + /* + * The URI to fetch the next page. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: List of device security group objects. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: List of device security group objects. + * + * @param value the value value to set. + * @return the DeviceSecurityGroupList object itself. + */ + public DeviceSecurityGroupList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The URI to fetch the next page. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DeviceSecurityGroups.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DeviceSecurityGroups.java new file mode 100644 index 000000000000..85ad35840b87 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DeviceSecurityGroups.java @@ -0,0 +1,141 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of DeviceSecurityGroups. */ +public interface DeviceSecurityGroups { + /** + * Use this method get the list of device security groups for the specified IoT Hub resource. + * + * @param resourceId The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of device security groups. + */ + PagedIterable list(String resourceId); + + /** + * Use this method get the list of device security groups for the specified IoT Hub resource. + * + * @param resourceId The identifier of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of device security groups. + */ + PagedIterable list(String resourceId, Context context); + + /** + * Use this method to get the device security group for the specified IoT Hub resource. + * + * @param resourceId The identifier of the resource. + * @param deviceSecurityGroupName The name of the device security group. Note that the name of the device security + * group is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the device security group resource. + */ + DeviceSecurityGroup get(String resourceId, String deviceSecurityGroupName); + + /** + * Use this method to get the device security group for the specified IoT Hub resource. + * + * @param resourceId The identifier of the resource. + * @param deviceSecurityGroupName The name of the device security group. Note that the name of the device security + * group is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the device security group resource. + */ + Response getWithResponse(String resourceId, String deviceSecurityGroupName, Context context); + + /** + * User this method to deletes the device security group. + * + * @param resourceId The identifier of the resource. + * @param deviceSecurityGroupName The name of the device security group. Note that the name of the device security + * group is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup(String resourceId, String deviceSecurityGroupName); + + /** + * User this method to deletes the device security group. + * + * @param resourceId The identifier of the resource. + * @param deviceSecurityGroupName The name of the device security group. Note that the name of the device security + * group is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response deleteWithResponse(String resourceId, String deviceSecurityGroupName, Context context); + + /** + * Use this method to get the device security group for the specified IoT Hub resource. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the device security group resource. + */ + DeviceSecurityGroup getById(String id); + + /** + * Use this method to get the device security group for the specified IoT Hub resource. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the device security group resource. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * User this method to deletes the device security group. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * User this method to deletes the device security group. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new DeviceSecurityGroup resource. + * + * @param name resource name. + * @return the first stage of the new DeviceSecurityGroup definition. + */ + DeviceSecurityGroup.DefinitionStages.Blank define(String name); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DeviceStatus.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DeviceStatus.java new file mode 100644 index 000000000000..e45e5661f745 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DeviceStatus.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for DeviceStatus. */ +public final class DeviceStatus extends ExpandableStringEnum { + /** Static value Active for DeviceStatus. */ + public static final DeviceStatus ACTIVE = fromString("Active"); + + /** Static value Removed for DeviceStatus. */ + public static final DeviceStatus REMOVED = fromString("Removed"); + + /** + * Creates or finds a DeviceStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding DeviceStatus. + */ + @JsonCreator + public static DeviceStatus fromString(String name) { + return fromString(name, DeviceStatus.class); + } + + /** @return known DeviceStatus values. */ + public static Collection values() { + return values(DeviceStatus.class); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Devices.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Devices.java new file mode 100644 index 000000000000..202f64be237e --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Devices.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of Devices. */ +public interface Devices { + /** + * Get device. + * + * @param resourceId The identifier of the resource. + * @param deviceId Identifier of the device. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return device. + */ + Device get(String resourceId, String deviceId); + + /** + * Get device. + * + * @param resourceId The identifier of the resource. + * @param deviceId Identifier of the device. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return device. + */ + Response getWithResponse(String resourceId, String deviceId, Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DevicesForHubs.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DevicesForHubs.java new file mode 100644 index 000000000000..f2da70879d18 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DevicesForHubs.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of DevicesForHubs. */ +public interface DevicesForHubs { + /** + * Get list of the devices for the specified IoT Hub resource. + * + * @param resourceId The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of the devices for the specified IoT Hub resource. + */ + PagedIterable list(String resourceId); + + /** + * Get list of the devices for the specified IoT Hub resource. + * + * @param resourceId The identifier of the resource. + * @param limit Limit the number of items returned in a single page. + * @param skipToken Skip token used for pagination. + * @param deviceManagementType Get devices only from specific type, Managed or Unmanaged. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of the devices for the specified IoT Hub resource. + */ + PagedIterable list( + String resourceId, Integer limit, String skipToken, ManagementState deviceManagementType, Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DevicesForSubscriptions.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DevicesForSubscriptions.java new file mode 100644 index 000000000000..b53f278dc088 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DevicesForSubscriptions.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of DevicesForSubscriptions. */ +public interface DevicesForSubscriptions { + /** + * Get list of the devices by their subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of the devices by their subscription. + */ + PagedIterable list(); + + /** + * Get list of the devices by their subscription. + * + * @param limit Limit the number of items returned in a single page. + * @param skipToken Skip token used for pagination. + * @param deviceManagementType Get devices only from specific type, Managed or Unmanaged. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of the devices by their subscription. + */ + PagedIterable list(Integer limit, String skipToken, ManagementState deviceManagementType, Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DirectMethodInvokesNotInAllowedRange.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DirectMethodInvokesNotInAllowedRange.java new file mode 100644 index 000000000000..686c2e668059 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DirectMethodInvokesNotInAllowedRange.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.time.Duration; + +/** Number of direct method invokes is not in allowed range. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "ruleType") +@JsonTypeName("DirectMethodInvokesNotInAllowedRange") +@Fluent +public final class DirectMethodInvokesNotInAllowedRange extends TimeWindowCustomAlertRule { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DirectMethodInvokesNotInAllowedRange.class); + + /** {@inheritDoc} */ + @Override + public DirectMethodInvokesNotInAllowedRange withTimeWindowSize(Duration timeWindowSize) { + super.withTimeWindowSize(timeWindowSize); + return this; + } + + /** {@inheritDoc} */ + @Override + public DirectMethodInvokesNotInAllowedRange withMinThreshold(int minThreshold) { + super.withMinThreshold(minThreshold); + return this; + } + + /** {@inheritDoc} */ + @Override + public DirectMethodInvokesNotInAllowedRange withMaxThreshold(int maxThreshold) { + super.withMaxThreshold(maxThreshold); + return this; + } + + /** {@inheritDoc} */ + @Override + public DirectMethodInvokesNotInAllowedRange withIsEnabled(boolean isEnabled) { + super.withIsEnabled(isEnabled); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Direction.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Direction.java new file mode 100644 index 000000000000..62c1004b68ae --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Direction.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for Direction. */ +public final class Direction extends ExpandableStringEnum { + /** Static value Inbound for Direction. */ + public static final Direction INBOUND = fromString("Inbound"); + + /** Static value Outbound for Direction. */ + public static final Direction OUTBOUND = fromString("Outbound"); + + /** + * Creates or finds a Direction from its string representation. + * + * @param name a name to look for. + * @return the corresponding Direction. + */ + @JsonCreator + public static Direction fromString(String name) { + return fromString(name, Direction.class); + } + + /** @return known Direction values. */ + public static Collection values() { + return values(Direction.class); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DiscoveredSecuritySolution.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DiscoveredSecuritySolution.java new file mode 100644 index 000000000000..bb8f1a56ab24 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DiscoveredSecuritySolution.java @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.resourcemanager.security.fluent.models.DiscoveredSecuritySolutionInner; + +/** An immutable client-side representation of DiscoveredSecuritySolution. */ +public interface DiscoveredSecuritySolution { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the securityFamily property: The security family of the discovered solution. + * + * @return the securityFamily value. + */ + SecurityFamily securityFamily(); + + /** + * Gets the offer property: The security solutions' image offer. + * + * @return the offer value. + */ + String offer(); + + /** + * Gets the publisher property: The security solutions' image publisher. + * + * @return the publisher value. + */ + String publisher(); + + /** + * Gets the sku property: The security solutions' image sku. + * + * @return the sku value. + */ + String sku(); + + /** + * Gets the location property: Location where the resource is stored. + * + * @return the location value. + */ + String location(); + + /** + * Gets the inner com.azure.resourcemanager.security.fluent.models.DiscoveredSecuritySolutionInner object. + * + * @return the inner object. + */ + DiscoveredSecuritySolutionInner innerModel(); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DiscoveredSecuritySolutionList.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DiscoveredSecuritySolutionList.java new file mode 100644 index 000000000000..869e5e2223ba --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DiscoveredSecuritySolutionList.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.models.DiscoveredSecuritySolutionInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The DiscoveredSecuritySolutionList model. */ +@Fluent +public final class DiscoveredSecuritySolutionList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DiscoveredSecuritySolutionList.class); + + /* + * The value property. + */ + @JsonProperty(value = "value") + private List value; + + /* + * The URI to fetch the next page. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: The value property. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The value property. + * + * @param value the value value to set. + * @return the DiscoveredSecuritySolutionList object itself. + */ + public DiscoveredSecuritySolutionList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The URI to fetch the next page. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DiscoveredSecuritySolutions.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DiscoveredSecuritySolutions.java new file mode 100644 index 000000000000..e1f8004ac08f --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DiscoveredSecuritySolutions.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of DiscoveredSecuritySolutions. */ +public interface DiscoveredSecuritySolutions { + /** + * Gets a list of discovered Security Solutions for the subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of discovered Security Solutions for the subscription. + */ + PagedIterable list(); + + /** + * Gets a list of discovered Security Solutions for the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of discovered Security Solutions for the subscription. + */ + PagedIterable list(Context context); + + /** + * Gets a list of discovered Security Solutions for the subscription and location. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of discovered Security Solutions for the subscription and location. + */ + PagedIterable listByHomeRegion(String ascLocation); + + /** + * Gets a list of discovered Security Solutions for the subscription and location. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of discovered Security Solutions for the subscription and location. + */ + PagedIterable listByHomeRegion(String ascLocation, Context context); + + /** + * Gets a specific discovered Security Solution. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param discoveredSecuritySolutionName Name of a discovered security solution. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a specific discovered Security Solution. + */ + DiscoveredSecuritySolution get(String resourceGroupName, String ascLocation, String discoveredSecuritySolutionName); + + /** + * Gets a specific discovered Security Solution. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param discoveredSecuritySolutionName Name of a discovered security solution. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a specific discovered Security Solution. + */ + Response getWithResponse( + String resourceGroupName, String ascLocation, String discoveredSecuritySolutionName, Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/EffectiveNetworkSecurityGroups.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/EffectiveNetworkSecurityGroups.java new file mode 100644 index 000000000000..a9e5165e801a --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/EffectiveNetworkSecurityGroups.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Describes the Network Security Groups effective on a network interface. */ +@Fluent +public final class EffectiveNetworkSecurityGroups { + @JsonIgnore private final ClientLogger logger = new ClientLogger(EffectiveNetworkSecurityGroups.class); + + /* + * The Azure resource ID of the network interface + */ + @JsonProperty(value = "networkInterface") + private String networkInterface; + + /* + * The Network Security Groups effective on the network interface + */ + @JsonProperty(value = "networkSecurityGroups") + private List networkSecurityGroups; + + /** + * Get the networkInterface property: The Azure resource ID of the network interface. + * + * @return the networkInterface value. + */ + public String networkInterface() { + return this.networkInterface; + } + + /** + * Set the networkInterface property: The Azure resource ID of the network interface. + * + * @param networkInterface the networkInterface value to set. + * @return the EffectiveNetworkSecurityGroups object itself. + */ + public EffectiveNetworkSecurityGroups withNetworkInterface(String networkInterface) { + this.networkInterface = networkInterface; + return this; + } + + /** + * Get the networkSecurityGroups property: The Network Security Groups effective on the network interface. + * + * @return the networkSecurityGroups value. + */ + public List networkSecurityGroups() { + return this.networkSecurityGroups; + } + + /** + * Set the networkSecurityGroups property: The Network Security Groups effective on the network interface. + * + * @param networkSecurityGroups the networkSecurityGroups value to set. + * @return the EffectiveNetworkSecurityGroups object itself. + */ + public EffectiveNetworkSecurityGroups withNetworkSecurityGroups(List networkSecurityGroups) { + this.networkSecurityGroups = networkSecurityGroups; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/EndOfSupportStatus.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/EndOfSupportStatus.java new file mode 100644 index 000000000000..ea8d6af25912 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/EndOfSupportStatus.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for EndOfSupportStatus. */ +public final class EndOfSupportStatus extends ExpandableStringEnum { + /** Static value None for EndOfSupportStatus. */ + public static final EndOfSupportStatus NONE = fromString("None"); + + /** Static value noLongerSupported for EndOfSupportStatus. */ + public static final EndOfSupportStatus NO_LONGER_SUPPORTED = fromString("noLongerSupported"); + + /** Static value versionNoLongerSupported for EndOfSupportStatus. */ + public static final EndOfSupportStatus VERSION_NO_LONGER_SUPPORTED = fromString("versionNoLongerSupported"); + + /** Static value upcomingNoLongerSupported for EndOfSupportStatus. */ + public static final EndOfSupportStatus UPCOMING_NO_LONGER_SUPPORTED = fromString("upcomingNoLongerSupported"); + + /** Static value upcomingVersionNoLongerSupported for EndOfSupportStatus. */ + public static final EndOfSupportStatus UPCOMING_VERSION_NO_LONGER_SUPPORTED = + fromString("upcomingVersionNoLongerSupported"); + + /** + * Creates or finds a EndOfSupportStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding EndOfSupportStatus. + */ + @JsonCreator + public static EndOfSupportStatus fromString(String name) { + return fromString(name, EndOfSupportStatus.class); + } + + /** @return known EndOfSupportStatus values. */ + public static Collection values() { + return values(EndOfSupportStatus.class); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/EnforcementMode.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/EnforcementMode.java new file mode 100644 index 000000000000..1758f1761d88 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/EnforcementMode.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for EnforcementMode. */ +public final class EnforcementMode extends ExpandableStringEnum { + /** Static value Audit for EnforcementMode. */ + public static final EnforcementMode AUDIT = fromString("Audit"); + + /** Static value Enforce for EnforcementMode. */ + public static final EnforcementMode ENFORCE = fromString("Enforce"); + + /** Static value None for EnforcementMode. */ + public static final EnforcementMode NONE = fromString("None"); + + /** + * Creates or finds a EnforcementMode from its string representation. + * + * @param name a name to look for. + * @return the corresponding EnforcementMode. + */ + @JsonCreator + public static EnforcementMode fromString(String name) { + return fromString(name, EnforcementMode.class); + } + + /** @return known EnforcementMode values. */ + public static Collection values() { + return values(EnforcementMode.class); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/EnforcementSupport.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/EnforcementSupport.java new file mode 100644 index 000000000000..eac88aa2995d --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/EnforcementSupport.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for EnforcementSupport. */ +public final class EnforcementSupport extends ExpandableStringEnum { + /** Static value Supported for EnforcementSupport. */ + public static final EnforcementSupport SUPPORTED = fromString("Supported"); + + /** Static value NotSupported for EnforcementSupport. */ + public static final EnforcementSupport NOT_SUPPORTED = fromString("NotSupported"); + + /** Static value Unknown for EnforcementSupport. */ + public static final EnforcementSupport UNKNOWN = fromString("Unknown"); + + /** + * Creates or finds a EnforcementSupport from its string representation. + * + * @param name a name to look for. + * @return the corresponding EnforcementSupport. + */ + @JsonCreator + public static EnforcementSupport fromString(String name) { + return fromString(name, EnforcementSupport.class); + } + + /** @return known EnforcementSupport values. */ + public static Collection values() { + return values(EnforcementSupport.class); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ErrorAdditionalInfo.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ErrorAdditionalInfo.java new file mode 100644 index 000000000000..0be5b8bf2e2d --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ErrorAdditionalInfo.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The resource management error additional info. */ +@Immutable +public final class ErrorAdditionalInfo { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ErrorAdditionalInfo.class); + + /* + * The additional info type. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /* + * The additional info. + */ + @JsonProperty(value = "info", access = JsonProperty.Access.WRITE_ONLY) + private Object info; + + /** + * Get the type property: The additional info type. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Get the info property: The additional info. + * + * @return the info value. + */ + public Object info() { + return this.info; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Etag.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Etag.java new file mode 100644 index 000000000000..12b2846757a1 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Etag.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Entity tag is used for comparing two or more entities from the same requested resource. */ +@Fluent +public class Etag { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Etag.class); + + /* + * Entity tag is used for comparing two or more entities from the same + * requested resource. + */ + @JsonProperty(value = "etag") + private String etag; + + /** + * Get the etag property: Entity tag is used for comparing two or more entities from the same requested resource. + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** + * Set the etag property: Entity tag is used for comparing two or more entities from the same requested resource. + * + * @param etag the etag value to set. + * @return the Etag object itself. + */ + public Etag withEtag(String etag) { + this.etag = etag; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/EventSource.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/EventSource.java new file mode 100644 index 000000000000..1b2a6b86c197 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/EventSource.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for EventSource. */ +public final class EventSource extends ExpandableStringEnum { + /** Static value Assessments for EventSource. */ + public static final EventSource ASSESSMENTS = fromString("Assessments"); + + /** Static value SubAssessments for EventSource. */ + public static final EventSource SUB_ASSESSMENTS = fromString("SubAssessments"); + + /** Static value Alerts for EventSource. */ + public static final EventSource ALERTS = fromString("Alerts"); + + /** Static value SecureScores for EventSource. */ + public static final EventSource SECURE_SCORES = fromString("SecureScores"); + + /** Static value SecureScoresSnapshot for EventSource. */ + public static final EventSource SECURE_SCORES_SNAPSHOT = fromString("SecureScoresSnapshot"); + + /** Static value SecureScoreControls for EventSource. */ + public static final EventSource SECURE_SCORE_CONTROLS = fromString("SecureScoreControls"); + + /** Static value SecureScoreControlsSnapshot for EventSource. */ + public static final EventSource SECURE_SCORE_CONTROLS_SNAPSHOT = fromString("SecureScoreControlsSnapshot"); + + /** Static value RegulatoryComplianceAssessment for EventSource. */ + public static final EventSource REGULATORY_COMPLIANCE_ASSESSMENT = fromString("RegulatoryComplianceAssessment"); + + /** Static value RegulatoryComplianceAssessmentSnapshot for EventSource. */ + public static final EventSource REGULATORY_COMPLIANCE_ASSESSMENT_SNAPSHOT = + fromString("RegulatoryComplianceAssessmentSnapshot"); + + /** + * Creates or finds a EventSource from its string representation. + * + * @param name a name to look for. + * @return the corresponding EventSource. + */ + @JsonCreator + public static EventSource fromString(String name) { + return fromString(name, EventSource.class); + } + + /** @return known EventSource values. */ + public static Collection values() { + return values(EventSource.class); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ExpandControlsEnum.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ExpandControlsEnum.java new file mode 100644 index 000000000000..a9feb6252e6f --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ExpandControlsEnum.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ExpandControlsEnum. */ +public final class ExpandControlsEnum extends ExpandableStringEnum { + /** Static value definition for ExpandControlsEnum. */ + public static final ExpandControlsEnum DEFINITION = fromString("definition"); + + /** + * Creates or finds a ExpandControlsEnum from its string representation. + * + * @param name a name to look for. + * @return the corresponding ExpandControlsEnum. + */ + @JsonCreator + public static ExpandControlsEnum fromString(String name) { + return fromString(name, ExpandControlsEnum.class); + } + + /** @return known ExpandControlsEnum values. */ + public static Collection values() { + return values(ExpandControlsEnum.class); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ExpandEnum.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ExpandEnum.java new file mode 100644 index 000000000000..70bd45304808 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ExpandEnum.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ExpandEnum. */ +public final class ExpandEnum extends ExpandableStringEnum { + /** Static value links for ExpandEnum. */ + public static final ExpandEnum LINKS = fromString("links"); + + /** Static value metadata for ExpandEnum. */ + public static final ExpandEnum METADATA = fromString("metadata"); + + /** + * Creates or finds a ExpandEnum from its string representation. + * + * @param name a name to look for. + * @return the corresponding ExpandEnum. + */ + @JsonCreator + public static ExpandEnum fromString(String name) { + return fromString(name, ExpandEnum.class); + } + + /** @return known ExpandEnum values. */ + public static Collection values() { + return values(ExpandEnum.class); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ExportData.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ExportData.java new file mode 100644 index 000000000000..a667ce2f9676 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ExportData.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ExportData. */ +public final class ExportData extends ExpandableStringEnum { + /** Static value RawEvents for ExportData. */ + public static final ExportData RAW_EVENTS = fromString("RawEvents"); + + /** + * Creates or finds a ExportData from its string representation. + * + * @param name a name to look for. + * @return the corresponding ExportData. + */ + @JsonCreator + public static ExportData fromString(String name) { + return fromString(name, ExportData.class); + } + + /** @return known ExportData values. */ + public static Collection values() { + return values(ExportData.class); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ExternalSecuritySolution.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ExternalSecuritySolution.java new file mode 100644 index 000000000000..59722076e72b --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ExternalSecuritySolution.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.resourcemanager.security.fluent.models.ExternalSecuritySolutionInner; + +/** An immutable client-side representation of ExternalSecuritySolution. */ +public interface ExternalSecuritySolution { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: Location where the resource is stored. + * + * @return the location value. + */ + String location(); + + /** + * Gets the inner com.azure.resourcemanager.security.fluent.models.ExternalSecuritySolutionInner object. + * + * @return the inner object. + */ + ExternalSecuritySolutionInner innerModel(); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ExternalSecuritySolutionKindValue.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ExternalSecuritySolutionKindValue.java new file mode 100644 index 000000000000..d77e2eea62ab --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ExternalSecuritySolutionKindValue.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ExternalSecuritySolutionKindValue. */ +public final class ExternalSecuritySolutionKindValue extends ExpandableStringEnum { + /** Static value CEF for ExternalSecuritySolutionKindValue. */ + public static final ExternalSecuritySolutionKindValue CEF = fromString("CEF"); + + /** Static value ATA for ExternalSecuritySolutionKindValue. */ + public static final ExternalSecuritySolutionKindValue ATA = fromString("ATA"); + + /** Static value AAD for ExternalSecuritySolutionKindValue. */ + public static final ExternalSecuritySolutionKindValue AAD = fromString("AAD"); + + /** + * Creates or finds a ExternalSecuritySolutionKindValue from its string representation. + * + * @param name a name to look for. + * @return the corresponding ExternalSecuritySolutionKindValue. + */ + @JsonCreator + public static ExternalSecuritySolutionKindValue fromString(String name) { + return fromString(name, ExternalSecuritySolutionKindValue.class); + } + + /** @return known ExternalSecuritySolutionKindValue values. */ + public static Collection values() { + return values(ExternalSecuritySolutionKindValue.class); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ExternalSecuritySolutionList.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ExternalSecuritySolutionList.java new file mode 100644 index 000000000000..12d4db1b58bd --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ExternalSecuritySolutionList.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.models.ExternalSecuritySolutionInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The ExternalSecuritySolutionList model. */ +@Fluent +public final class ExternalSecuritySolutionList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ExternalSecuritySolutionList.class); + + /* + * The value property. + */ + @JsonProperty(value = "value") + private List value; + + /* + * The URI to fetch the next page. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: The value property. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The value property. + * + * @param value the value value to set. + * @return the ExternalSecuritySolutionList object itself. + */ + public ExternalSecuritySolutionList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The URI to fetch the next page. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ExternalSecuritySolutionProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ExternalSecuritySolutionProperties.java new file mode 100644 index 000000000000..db76d496bb1b --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ExternalSecuritySolutionProperties.java @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.HashMap; +import java.util.Map; + +/** The solution properties (correspond to the solution kind). */ +@Fluent +public class ExternalSecuritySolutionProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ExternalSecuritySolutionProperties.class); + + /* + * The deviceVendor property. + */ + @JsonProperty(value = "deviceVendor") + private String deviceVendor; + + /* + * The deviceType property. + */ + @JsonProperty(value = "deviceType") + private String deviceType; + + /* + * Represents an OMS workspace to which the solution is connected + */ + @JsonProperty(value = "workspace") + private ConnectedWorkspace workspace; + + /* + * The solution properties (correspond to the solution kind) + */ + @JsonIgnore private Map additionalProperties; + + /** + * Get the deviceVendor property: The deviceVendor property. + * + * @return the deviceVendor value. + */ + public String deviceVendor() { + return this.deviceVendor; + } + + /** + * Set the deviceVendor property: The deviceVendor property. + * + * @param deviceVendor the deviceVendor value to set. + * @return the ExternalSecuritySolutionProperties object itself. + */ + public ExternalSecuritySolutionProperties withDeviceVendor(String deviceVendor) { + this.deviceVendor = deviceVendor; + return this; + } + + /** + * Get the deviceType property: The deviceType property. + * + * @return the deviceType value. + */ + public String deviceType() { + return this.deviceType; + } + + /** + * Set the deviceType property: The deviceType property. + * + * @param deviceType the deviceType value to set. + * @return the ExternalSecuritySolutionProperties object itself. + */ + public ExternalSecuritySolutionProperties withDeviceType(String deviceType) { + this.deviceType = deviceType; + return this; + } + + /** + * Get the workspace property: Represents an OMS workspace to which the solution is connected. + * + * @return the workspace value. + */ + public ConnectedWorkspace workspace() { + return this.workspace; + } + + /** + * Set the workspace property: Represents an OMS workspace to which the solution is connected. + * + * @param workspace the workspace value to set. + * @return the ExternalSecuritySolutionProperties object itself. + */ + public ExternalSecuritySolutionProperties withWorkspace(ConnectedWorkspace workspace) { + this.workspace = workspace; + return this; + } + + /** + * Get the additionalProperties property: The solution properties (correspond to the solution kind). + * + * @return the additionalProperties value. + */ + @JsonAnyGetter + public Map additionalProperties() { + return this.additionalProperties; + } + + /** + * Set the additionalProperties property: The solution properties (correspond to the solution kind). + * + * @param additionalProperties the additionalProperties value to set. + * @return the ExternalSecuritySolutionProperties object itself. + */ + public ExternalSecuritySolutionProperties withAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + @JsonAnySetter + void withAdditionalProperties(String key, Object value) { + if (additionalProperties == null) { + additionalProperties = new HashMap<>(); + } + additionalProperties.put(key, value); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (workspace() != null) { + workspace().validate(); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ExternalSecuritySolutions.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ExternalSecuritySolutions.java new file mode 100644 index 000000000000..3d05e7f8e587 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ExternalSecuritySolutions.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of ExternalSecuritySolutions. */ +public interface ExternalSecuritySolutions { + /** + * Gets a list of external security solutions for the subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of external security solutions for the subscription. + */ + PagedIterable list(); + + /** + * Gets a list of external security solutions for the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of external security solutions for the subscription. + */ + PagedIterable list(Context context); + + /** + * Gets a list of external Security Solutions for the subscription and location. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of external Security Solutions for the subscription and location. + */ + PagedIterable listByHomeRegion(String ascLocation); + + /** + * Gets a list of external Security Solutions for the subscription and location. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of external Security Solutions for the subscription and location. + */ + PagedIterable listByHomeRegion(String ascLocation, Context context); + + /** + * Gets a specific external Security Solution. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param externalSecuritySolutionsName Name of an external security solution. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a specific external Security Solution. + */ + ExternalSecuritySolution get(String resourceGroupName, String ascLocation, String externalSecuritySolutionsName); + + /** + * Gets a specific external Security Solution. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param externalSecuritySolutionsName Name of an external security solution. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a specific external Security Solution. + */ + Response getWithResponse( + String resourceGroupName, String ascLocation, String externalSecuritySolutionsName, Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/FailedLocalLoginsNotInAllowedRange.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/FailedLocalLoginsNotInAllowedRange.java new file mode 100644 index 000000000000..66aa8eedf13f --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/FailedLocalLoginsNotInAllowedRange.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.time.Duration; + +/** Number of failed local logins is not in allowed range. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "ruleType") +@JsonTypeName("FailedLocalLoginsNotInAllowedRange") +@Fluent +public final class FailedLocalLoginsNotInAllowedRange extends TimeWindowCustomAlertRule { + @JsonIgnore private final ClientLogger logger = new ClientLogger(FailedLocalLoginsNotInAllowedRange.class); + + /** {@inheritDoc} */ + @Override + public FailedLocalLoginsNotInAllowedRange withTimeWindowSize(Duration timeWindowSize) { + super.withTimeWindowSize(timeWindowSize); + return this; + } + + /** {@inheritDoc} */ + @Override + public FailedLocalLoginsNotInAllowedRange withMinThreshold(int minThreshold) { + super.withMinThreshold(minThreshold); + return this; + } + + /** {@inheritDoc} */ + @Override + public FailedLocalLoginsNotInAllowedRange withMaxThreshold(int maxThreshold) { + super.withMaxThreshold(maxThreshold); + return this; + } + + /** {@inheritDoc} */ + @Override + public FailedLocalLoginsNotInAllowedRange withIsEnabled(boolean isEnabled) { + super.withIsEnabled(isEnabled); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/FileType.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/FileType.java new file mode 100644 index 000000000000..c61dafbd1a7f --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/FileType.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for FileType. */ +public final class FileType extends ExpandableStringEnum { + /** Static value Exe for FileType. */ + public static final FileType EXE = fromString("Exe"); + + /** Static value Dll for FileType. */ + public static final FileType DLL = fromString("Dll"); + + /** Static value Msi for FileType. */ + public static final FileType MSI = fromString("Msi"); + + /** Static value Script for FileType. */ + public static final FileType SCRIPT = fromString("Script"); + + /** Static value Executable for FileType. */ + public static final FileType EXECUTABLE = fromString("Executable"); + + /** Static value Unknown for FileType. */ + public static final FileType UNKNOWN = fromString("Unknown"); + + /** + * Creates or finds a FileType from its string representation. + * + * @param name a name to look for. + * @return the corresponding FileType. + */ + @JsonCreator + public static FileType fromString(String name) { + return fromString(name, FileType.class); + } + + /** @return known FileType values. */ + public static Collection values() { + return values(FileType.class); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/FileUploadsNotInAllowedRange.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/FileUploadsNotInAllowedRange.java new file mode 100644 index 000000000000..dc663b1151cb --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/FileUploadsNotInAllowedRange.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.time.Duration; + +/** Number of file uploads is not in allowed range. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "ruleType") +@JsonTypeName("FileUploadsNotInAllowedRange") +@Fluent +public final class FileUploadsNotInAllowedRange extends TimeWindowCustomAlertRule { + @JsonIgnore private final ClientLogger logger = new ClientLogger(FileUploadsNotInAllowedRange.class); + + /** {@inheritDoc} */ + @Override + public FileUploadsNotInAllowedRange withTimeWindowSize(Duration timeWindowSize) { + super.withTimeWindowSize(timeWindowSize); + return this; + } + + /** {@inheritDoc} */ + @Override + public FileUploadsNotInAllowedRange withMinThreshold(int minThreshold) { + super.withMinThreshold(minThreshold); + return this; + } + + /** {@inheritDoc} */ + @Override + public FileUploadsNotInAllowedRange withMaxThreshold(int maxThreshold) { + super.withMaxThreshold(maxThreshold); + return this; + } + + /** {@inheritDoc} */ + @Override + public FileUploadsNotInAllowedRange withIsEnabled(boolean isEnabled) { + super.withIsEnabled(isEnabled); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Firmware.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Firmware.java new file mode 100644 index 000000000000..d1fa6bff3264 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Firmware.java @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Firmware information. */ +@Immutable +public final class Firmware { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Firmware.class); + + /* + * Address of the specific module a firmware is related to + */ + @JsonProperty(value = "moduleAddress", access = JsonProperty.Access.WRITE_ONLY) + private String moduleAddress; + + /* + * Rack number of the module a firmware is related to. + */ + @JsonProperty(value = "rack", access = JsonProperty.Access.WRITE_ONLY) + private String rack; + + /* + * Slot number in the rack of the module a firmware is related to + */ + @JsonProperty(value = "slot", access = JsonProperty.Access.WRITE_ONLY) + private String slot; + + /* + * Serial of the firmware + */ + @JsonProperty(value = "serial", access = JsonProperty.Access.WRITE_ONLY) + private String serial; + + /* + * Firmware model + */ + @JsonProperty(value = "model", access = JsonProperty.Access.WRITE_ONLY) + private String model; + + /* + * Firmware version + */ + @JsonProperty(value = "version", access = JsonProperty.Access.WRITE_ONLY) + private String version; + + /* + * A bag of fields which extends the firmware information. + */ + @JsonProperty(value = "additionalData", access = JsonProperty.Access.WRITE_ONLY) + private Object additionalData; + + /** + * Get the moduleAddress property: Address of the specific module a firmware is related to. + * + * @return the moduleAddress value. + */ + public String moduleAddress() { + return this.moduleAddress; + } + + /** + * Get the rack property: Rack number of the module a firmware is related to. + * + * @return the rack value. + */ + public String rack() { + return this.rack; + } + + /** + * Get the slot property: Slot number in the rack of the module a firmware is related to. + * + * @return the slot value. + */ + public String slot() { + return this.slot; + } + + /** + * Get the serial property: Serial of the firmware. + * + * @return the serial value. + */ + public String serial() { + return this.serial; + } + + /** + * Get the model property: Firmware model. + * + * @return the model value. + */ + public String model() { + return this.model; + } + + /** + * Get the version property: Firmware version. + * + * @return the version value. + */ + public String version() { + return this.version; + } + + /** + * Get the additionalData property: A bag of fields which extends the firmware information. + * + * @return the additionalData value. + */ + public Object additionalData() { + return this.additionalData; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/GcpCredentialsDetailsProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/GcpCredentialsDetailsProperties.java new file mode 100644 index 000000000000..3b11122ac487 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/GcpCredentialsDetailsProperties.java @@ -0,0 +1,385 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * GCP cloud account connector based service to service credentials, the credentials are composed of the organization ID + * and a JSON API key (write only). + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "authenticationType") +@JsonTypeName("gcpCredentials") +@Fluent +public final class GcpCredentialsDetailsProperties extends AuthenticationDetailsProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(GcpCredentialsDetailsProperties.class); + + /* + * The organization ID of the GCP cloud account + */ + @JsonProperty(value = "organizationId", required = true) + private String organizationId; + + /* + * Type field of the API key (write only) + */ + @JsonProperty(value = "type", required = true) + private String type; + + /* + * Project ID field of the API key (write only) + */ + @JsonProperty(value = "projectId", required = true) + private String projectId; + + /* + * Private key ID field of the API key (write only) + */ + @JsonProperty(value = "privateKeyId", required = true) + private String privateKeyId; + + /* + * Private key field of the API key (write only) + */ + @JsonProperty(value = "privateKey", required = true) + private String privateKey; + + /* + * Client email field of the API key (write only) + */ + @JsonProperty(value = "clientEmail", required = true) + private String clientEmail; + + /* + * Client ID field of the API key (write only) + */ + @JsonProperty(value = "clientId", required = true) + private String clientId; + + /* + * Auth URI field of the API key (write only) + */ + @JsonProperty(value = "authUri", required = true) + private String authUri; + + /* + * Token URI field of the API key (write only) + */ + @JsonProperty(value = "tokenUri", required = true) + private String tokenUri; + + /* + * Auth provider x509 certificate URL field of the API key (write only) + */ + @JsonProperty(value = "authProviderX509CertUrl", required = true) + private String authProviderX509CertUrl; + + /* + * Client x509 certificate URL field of the API key (write only) + */ + @JsonProperty(value = "clientX509CertUrl", required = true) + private String clientX509CertUrl; + + /** + * Get the organizationId property: The organization ID of the GCP cloud account. + * + * @return the organizationId value. + */ + public String organizationId() { + return this.organizationId; + } + + /** + * Set the organizationId property: The organization ID of the GCP cloud account. + * + * @param organizationId the organizationId value to set. + * @return the GcpCredentialsDetailsProperties object itself. + */ + public GcpCredentialsDetailsProperties withOrganizationId(String organizationId) { + this.organizationId = organizationId; + return this; + } + + /** + * Get the type property: Type field of the API key (write only). + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Set the type property: Type field of the API key (write only). + * + * @param type the type value to set. + * @return the GcpCredentialsDetailsProperties object itself. + */ + public GcpCredentialsDetailsProperties withType(String type) { + this.type = type; + return this; + } + + /** + * Get the projectId property: Project ID field of the API key (write only). + * + * @return the projectId value. + */ + public String projectId() { + return this.projectId; + } + + /** + * Set the projectId property: Project ID field of the API key (write only). + * + * @param projectId the projectId value to set. + * @return the GcpCredentialsDetailsProperties object itself. + */ + public GcpCredentialsDetailsProperties withProjectId(String projectId) { + this.projectId = projectId; + return this; + } + + /** + * Get the privateKeyId property: Private key ID field of the API key (write only). + * + * @return the privateKeyId value. + */ + public String privateKeyId() { + return this.privateKeyId; + } + + /** + * Set the privateKeyId property: Private key ID field of the API key (write only). + * + * @param privateKeyId the privateKeyId value to set. + * @return the GcpCredentialsDetailsProperties object itself. + */ + public GcpCredentialsDetailsProperties withPrivateKeyId(String privateKeyId) { + this.privateKeyId = privateKeyId; + return this; + } + + /** + * Get the privateKey property: Private key field of the API key (write only). + * + * @return the privateKey value. + */ + public String privateKey() { + return this.privateKey; + } + + /** + * Set the privateKey property: Private key field of the API key (write only). + * + * @param privateKey the privateKey value to set. + * @return the GcpCredentialsDetailsProperties object itself. + */ + public GcpCredentialsDetailsProperties withPrivateKey(String privateKey) { + this.privateKey = privateKey; + return this; + } + + /** + * Get the clientEmail property: Client email field of the API key (write only). + * + * @return the clientEmail value. + */ + public String clientEmail() { + return this.clientEmail; + } + + /** + * Set the clientEmail property: Client email field of the API key (write only). + * + * @param clientEmail the clientEmail value to set. + * @return the GcpCredentialsDetailsProperties object itself. + */ + public GcpCredentialsDetailsProperties withClientEmail(String clientEmail) { + this.clientEmail = clientEmail; + return this; + } + + /** + * Get the clientId property: Client ID field of the API key (write only). + * + * @return the clientId value. + */ + public String clientId() { + return this.clientId; + } + + /** + * Set the clientId property: Client ID field of the API key (write only). + * + * @param clientId the clientId value to set. + * @return the GcpCredentialsDetailsProperties object itself. + */ + public GcpCredentialsDetailsProperties withClientId(String clientId) { + this.clientId = clientId; + return this; + } + + /** + * Get the authUri property: Auth URI field of the API key (write only). + * + * @return the authUri value. + */ + public String authUri() { + return this.authUri; + } + + /** + * Set the authUri property: Auth URI field of the API key (write only). + * + * @param authUri the authUri value to set. + * @return the GcpCredentialsDetailsProperties object itself. + */ + public GcpCredentialsDetailsProperties withAuthUri(String authUri) { + this.authUri = authUri; + return this; + } + + /** + * Get the tokenUri property: Token URI field of the API key (write only). + * + * @return the tokenUri value. + */ + public String tokenUri() { + return this.tokenUri; + } + + /** + * Set the tokenUri property: Token URI field of the API key (write only). + * + * @param tokenUri the tokenUri value to set. + * @return the GcpCredentialsDetailsProperties object itself. + */ + public GcpCredentialsDetailsProperties withTokenUri(String tokenUri) { + this.tokenUri = tokenUri; + return this; + } + + /** + * Get the authProviderX509CertUrl property: Auth provider x509 certificate URL field of the API key (write only). + * + * @return the authProviderX509CertUrl value. + */ + public String authProviderX509CertUrl() { + return this.authProviderX509CertUrl; + } + + /** + * Set the authProviderX509CertUrl property: Auth provider x509 certificate URL field of the API key (write only). + * + * @param authProviderX509CertUrl the authProviderX509CertUrl value to set. + * @return the GcpCredentialsDetailsProperties object itself. + */ + public GcpCredentialsDetailsProperties withAuthProviderX509CertUrl(String authProviderX509CertUrl) { + this.authProviderX509CertUrl = authProviderX509CertUrl; + return this; + } + + /** + * Get the clientX509CertUrl property: Client x509 certificate URL field of the API key (write only). + * + * @return the clientX509CertUrl value. + */ + public String clientX509CertUrl() { + return this.clientX509CertUrl; + } + + /** + * Set the clientX509CertUrl property: Client x509 certificate URL field of the API key (write only). + * + * @param clientX509CertUrl the clientX509CertUrl value to set. + * @return the GcpCredentialsDetailsProperties object itself. + */ + public GcpCredentialsDetailsProperties withClientX509CertUrl(String clientX509CertUrl) { + this.clientX509CertUrl = clientX509CertUrl; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (organizationId() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property organizationId in model GcpCredentialsDetailsProperties")); + } + if (type() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property type in model GcpCredentialsDetailsProperties")); + } + if (projectId() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property projectId in model GcpCredentialsDetailsProperties")); + } + if (privateKeyId() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property privateKeyId in model GcpCredentialsDetailsProperties")); + } + if (privateKey() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property privateKey in model GcpCredentialsDetailsProperties")); + } + if (clientEmail() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property clientEmail in model GcpCredentialsDetailsProperties")); + } + if (clientId() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property clientId in model GcpCredentialsDetailsProperties")); + } + if (authUri() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property authUri in model GcpCredentialsDetailsProperties")); + } + if (tokenUri() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property tokenUri in model GcpCredentialsDetailsProperties")); + } + if (authProviderX509CertUrl() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property authProviderX509CertUrl in model GcpCredentialsDetailsProperties")); + } + if (clientX509CertUrl() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property clientX509CertUrl in model GcpCredentialsDetailsProperties")); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/HttpC2DMessagesNotInAllowedRange.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/HttpC2DMessagesNotInAllowedRange.java new file mode 100644 index 000000000000..168ec600d2b4 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/HttpC2DMessagesNotInAllowedRange.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.time.Duration; + +/** Number of cloud to device messages (HTTP protocol) is not in allowed range. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "ruleType") +@JsonTypeName("HttpC2DMessagesNotInAllowedRange") +@Fluent +public final class HttpC2DMessagesNotInAllowedRange extends TimeWindowCustomAlertRule { + @JsonIgnore private final ClientLogger logger = new ClientLogger(HttpC2DMessagesNotInAllowedRange.class); + + /** {@inheritDoc} */ + @Override + public HttpC2DMessagesNotInAllowedRange withTimeWindowSize(Duration timeWindowSize) { + super.withTimeWindowSize(timeWindowSize); + return this; + } + + /** {@inheritDoc} */ + @Override + public HttpC2DMessagesNotInAllowedRange withMinThreshold(int minThreshold) { + super.withMinThreshold(minThreshold); + return this; + } + + /** {@inheritDoc} */ + @Override + public HttpC2DMessagesNotInAllowedRange withMaxThreshold(int maxThreshold) { + super.withMaxThreshold(maxThreshold); + return this; + } + + /** {@inheritDoc} */ + @Override + public HttpC2DMessagesNotInAllowedRange withIsEnabled(boolean isEnabled) { + super.withIsEnabled(isEnabled); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/HttpC2DRejectedMessagesNotInAllowedRange.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/HttpC2DRejectedMessagesNotInAllowedRange.java new file mode 100644 index 000000000000..771a91bcf644 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/HttpC2DRejectedMessagesNotInAllowedRange.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.time.Duration; + +/** Number of rejected cloud to device messages (HTTP protocol) is not in allowed range. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "ruleType") +@JsonTypeName("HttpC2DRejectedMessagesNotInAllowedRange") +@Fluent +public final class HttpC2DRejectedMessagesNotInAllowedRange extends TimeWindowCustomAlertRule { + @JsonIgnore private final ClientLogger logger = new ClientLogger(HttpC2DRejectedMessagesNotInAllowedRange.class); + + /** {@inheritDoc} */ + @Override + public HttpC2DRejectedMessagesNotInAllowedRange withTimeWindowSize(Duration timeWindowSize) { + super.withTimeWindowSize(timeWindowSize); + return this; + } + + /** {@inheritDoc} */ + @Override + public HttpC2DRejectedMessagesNotInAllowedRange withMinThreshold(int minThreshold) { + super.withMinThreshold(minThreshold); + return this; + } + + /** {@inheritDoc} */ + @Override + public HttpC2DRejectedMessagesNotInAllowedRange withMaxThreshold(int maxThreshold) { + super.withMaxThreshold(maxThreshold); + return this; + } + + /** {@inheritDoc} */ + @Override + public HttpC2DRejectedMessagesNotInAllowedRange withIsEnabled(boolean isEnabled) { + super.withIsEnabled(isEnabled); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/HttpD2CMessagesNotInAllowedRange.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/HttpD2CMessagesNotInAllowedRange.java new file mode 100644 index 000000000000..5c83dab56bd0 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/HttpD2CMessagesNotInAllowedRange.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.time.Duration; + +/** Number of device to cloud messages (HTTP protocol) is not in allowed range. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "ruleType") +@JsonTypeName("HttpD2CMessagesNotInAllowedRange") +@Fluent +public final class HttpD2CMessagesNotInAllowedRange extends TimeWindowCustomAlertRule { + @JsonIgnore private final ClientLogger logger = new ClientLogger(HttpD2CMessagesNotInAllowedRange.class); + + /** {@inheritDoc} */ + @Override + public HttpD2CMessagesNotInAllowedRange withTimeWindowSize(Duration timeWindowSize) { + super.withTimeWindowSize(timeWindowSize); + return this; + } + + /** {@inheritDoc} */ + @Override + public HttpD2CMessagesNotInAllowedRange withMinThreshold(int minThreshold) { + super.withMinThreshold(minThreshold); + return this; + } + + /** {@inheritDoc} */ + @Override + public HttpD2CMessagesNotInAllowedRange withMaxThreshold(int maxThreshold) { + super.withMaxThreshold(maxThreshold); + return this; + } + + /** {@inheritDoc} */ + @Override + public HttpD2CMessagesNotInAllowedRange withIsEnabled(boolean isEnabled) { + super.withIsEnabled(isEnabled); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/HybridComputeProvisioningState.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/HybridComputeProvisioningState.java new file mode 100644 index 000000000000..2e76925fe712 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/HybridComputeProvisioningState.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for HybridComputeProvisioningState. */ +public final class HybridComputeProvisioningState extends ExpandableStringEnum { + /** Static value Valid for HybridComputeProvisioningState. */ + public static final HybridComputeProvisioningState VALID = fromString("Valid"); + + /** Static value Invalid for HybridComputeProvisioningState. */ + public static final HybridComputeProvisioningState INVALID = fromString("Invalid"); + + /** Static value Expired for HybridComputeProvisioningState. */ + public static final HybridComputeProvisioningState EXPIRED = fromString("Expired"); + + /** + * Creates or finds a HybridComputeProvisioningState from its string representation. + * + * @param name a name to look for. + * @return the corresponding HybridComputeProvisioningState. + */ + @JsonCreator + public static HybridComputeProvisioningState fromString(String name) { + return fromString(name, HybridComputeProvisioningState.class); + } + + /** @return known HybridComputeProvisioningState values. */ + public static Collection values() { + return values(HybridComputeProvisioningState.class); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/HybridComputeSettingsProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/HybridComputeSettingsProperties.java new file mode 100644 index 000000000000..849dc1f9449b --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/HybridComputeSettingsProperties.java @@ -0,0 +1,190 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Settings for hybrid compute management. */ +@Fluent +public final class HybridComputeSettingsProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(HybridComputeSettingsProperties.class); + + /* + * State of the service principal and its secret + */ + @JsonProperty(value = "hybridComputeProvisioningState", access = JsonProperty.Access.WRITE_ONLY) + private HybridComputeProvisioningState hybridComputeProvisioningState; + + /* + * Whether or not to automatically install Azure Arc (hybrid compute) + * agents on machines + */ + @JsonProperty(value = "autoProvision", required = true) + private AutoProvision autoProvision; + + /* + * The name of the resource group where Arc (Hybrid Compute) connectors are + * connected. + */ + @JsonProperty(value = "resourceGroupName") + private String resourceGroupName; + + /* + * The location where the metadata of machines will be stored + */ + @JsonProperty(value = "region") + private String region; + + /* + * For a non-Azure machine that is not connected directly to the internet, + * specify a proxy server that the non-Azure machine can use. + */ + @JsonProperty(value = "proxyServer") + private ProxyServerProperties proxyServer; + + /* + * An object to access resources that are secured by an Azure AD tenant. + */ + @JsonProperty(value = "servicePrincipal") + private ServicePrincipalProperties servicePrincipal; + + /** + * Get the hybridComputeProvisioningState property: State of the service principal and its secret. + * + * @return the hybridComputeProvisioningState value. + */ + public HybridComputeProvisioningState hybridComputeProvisioningState() { + return this.hybridComputeProvisioningState; + } + + /** + * Get the autoProvision property: Whether or not to automatically install Azure Arc (hybrid compute) agents on + * machines. + * + * @return the autoProvision value. + */ + public AutoProvision autoProvision() { + return this.autoProvision; + } + + /** + * Set the autoProvision property: Whether or not to automatically install Azure Arc (hybrid compute) agents on + * machines. + * + * @param autoProvision the autoProvision value to set. + * @return the HybridComputeSettingsProperties object itself. + */ + public HybridComputeSettingsProperties withAutoProvision(AutoProvision autoProvision) { + this.autoProvision = autoProvision; + return this; + } + + /** + * Get the resourceGroupName property: The name of the resource group where Arc (Hybrid Compute) connectors are + * connected. + * + * @return the resourceGroupName value. + */ + public String resourceGroupName() { + return this.resourceGroupName; + } + + /** + * Set the resourceGroupName property: The name of the resource group where Arc (Hybrid Compute) connectors are + * connected. + * + * @param resourceGroupName the resourceGroupName value to set. + * @return the HybridComputeSettingsProperties object itself. + */ + public HybridComputeSettingsProperties withResourceGroupName(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + /** + * Get the region property: The location where the metadata of machines will be stored. + * + * @return the region value. + */ + public String region() { + return this.region; + } + + /** + * Set the region property: The location where the metadata of machines will be stored. + * + * @param region the region value to set. + * @return the HybridComputeSettingsProperties object itself. + */ + public HybridComputeSettingsProperties withRegion(String region) { + this.region = region; + return this; + } + + /** + * Get the proxyServer property: For a non-Azure machine that is not connected directly to the internet, specify a + * proxy server that the non-Azure machine can use. + * + * @return the proxyServer value. + */ + public ProxyServerProperties proxyServer() { + return this.proxyServer; + } + + /** + * Set the proxyServer property: For a non-Azure machine that is not connected directly to the internet, specify a + * proxy server that the non-Azure machine can use. + * + * @param proxyServer the proxyServer value to set. + * @return the HybridComputeSettingsProperties object itself. + */ + public HybridComputeSettingsProperties withProxyServer(ProxyServerProperties proxyServer) { + this.proxyServer = proxyServer; + return this; + } + + /** + * Get the servicePrincipal property: An object to access resources that are secured by an Azure AD tenant. + * + * @return the servicePrincipal value. + */ + public ServicePrincipalProperties servicePrincipal() { + return this.servicePrincipal; + } + + /** + * Set the servicePrincipal property: An object to access resources that are secured by an Azure AD tenant. + * + * @param servicePrincipal the servicePrincipal value to set. + * @return the HybridComputeSettingsProperties object itself. + */ + public HybridComputeSettingsProperties withServicePrincipal(ServicePrincipalProperties servicePrincipal) { + this.servicePrincipal = servicePrincipal; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (autoProvision() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property autoProvision in model HybridComputeSettingsProperties")); + } + if (proxyServer() != null) { + proxyServer().validate(); + } + if (servicePrincipal() != null) { + servicePrincipal().validate(); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ImplementationEffort.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ImplementationEffort.java new file mode 100644 index 000000000000..f1156bab6193 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ImplementationEffort.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ImplementationEffort. */ +public final class ImplementationEffort extends ExpandableStringEnum { + /** Static value Low for ImplementationEffort. */ + public static final ImplementationEffort LOW = fromString("Low"); + + /** Static value Moderate for ImplementationEffort. */ + public static final ImplementationEffort MODERATE = fromString("Moderate"); + + /** Static value High for ImplementationEffort. */ + public static final ImplementationEffort HIGH = fromString("High"); + + /** + * Creates or finds a ImplementationEffort from its string representation. + * + * @param name a name to look for. + * @return the corresponding ImplementationEffort. + */ + @JsonCreator + public static ImplementationEffort fromString(String name) { + return fromString(name, ImplementationEffort.class); + } + + /** @return known ImplementationEffort values. */ + public static Collection values() { + return values(ImplementationEffort.class); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/InformationProtectionKeyword.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/InformationProtectionKeyword.java new file mode 100644 index 000000000000..caad869f5847 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/InformationProtectionKeyword.java @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The information type keyword. */ +@Fluent +public final class InformationProtectionKeyword { + @JsonIgnore private final ClientLogger logger = new ClientLogger(InformationProtectionKeyword.class); + + /* + * The keyword pattern. + */ + @JsonProperty(value = "pattern") + private String pattern; + + /* + * Indicates whether the keyword is custom or not. + */ + @JsonProperty(value = "custom") + private Boolean custom; + + /* + * Indicates whether the keyword can be applied on numeric types or not. + */ + @JsonProperty(value = "canBeNumeric") + private Boolean canBeNumeric; + + /* + * Indicates whether the keyword is excluded or not. + */ + @JsonProperty(value = "excluded") + private Boolean excluded; + + /** + * Get the pattern property: The keyword pattern. + * + * @return the pattern value. + */ + public String pattern() { + return this.pattern; + } + + /** + * Set the pattern property: The keyword pattern. + * + * @param pattern the pattern value to set. + * @return the InformationProtectionKeyword object itself. + */ + public InformationProtectionKeyword withPattern(String pattern) { + this.pattern = pattern; + return this; + } + + /** + * Get the custom property: Indicates whether the keyword is custom or not. + * + * @return the custom value. + */ + public Boolean custom() { + return this.custom; + } + + /** + * Set the custom property: Indicates whether the keyword is custom or not. + * + * @param custom the custom value to set. + * @return the InformationProtectionKeyword object itself. + */ + public InformationProtectionKeyword withCustom(Boolean custom) { + this.custom = custom; + return this; + } + + /** + * Get the canBeNumeric property: Indicates whether the keyword can be applied on numeric types or not. + * + * @return the canBeNumeric value. + */ + public Boolean canBeNumeric() { + return this.canBeNumeric; + } + + /** + * Set the canBeNumeric property: Indicates whether the keyword can be applied on numeric types or not. + * + * @param canBeNumeric the canBeNumeric value to set. + * @return the InformationProtectionKeyword object itself. + */ + public InformationProtectionKeyword withCanBeNumeric(Boolean canBeNumeric) { + this.canBeNumeric = canBeNumeric; + return this; + } + + /** + * Get the excluded property: Indicates whether the keyword is excluded or not. + * + * @return the excluded value. + */ + public Boolean excluded() { + return this.excluded; + } + + /** + * Set the excluded property: Indicates whether the keyword is excluded or not. + * + * @param excluded the excluded value to set. + * @return the InformationProtectionKeyword object itself. + */ + public InformationProtectionKeyword withExcluded(Boolean excluded) { + this.excluded = excluded; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/InformationProtectionPolicies.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/InformationProtectionPolicies.java new file mode 100644 index 000000000000..a9f2fcc645b0 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/InformationProtectionPolicies.java @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of InformationProtectionPolicies. */ +public interface InformationProtectionPolicies { + /** + * Details of the information protection policy. + * + * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @param informationProtectionPolicyName Name of the information protection policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information protection policy. + */ + InformationProtectionPolicy get( + String scope, InformationProtectionPoliciesInformationProtectionPolicyName informationProtectionPolicyName); + + /** + * Details of the information protection policy. + * + * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @param informationProtectionPolicyName Name of the information protection policy. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information protection policy. + */ + Response getWithResponse( + String scope, + InformationProtectionPoliciesInformationProtectionPolicyName informationProtectionPolicyName, + Context context); + + /** + * Information protection policies of a specific management group. + * + * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information protection policies response. + */ + PagedIterable list(String scope); + + /** + * Information protection policies of a specific management group. + * + * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information protection policies response. + */ + PagedIterable list(String scope, Context context); + + /** + * Details of the information protection policy. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information protection policy. + */ + InformationProtectionPolicy getById(String id); + + /** + * Details of the information protection policy. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information protection policy. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new InformationProtectionPolicy resource. + * + * @param name resource name. + * @return the first stage of the new InformationProtectionPolicy definition. + */ + InformationProtectionPolicy.DefinitionStages.Blank define( + InformationProtectionPoliciesInformationProtectionPolicyName name); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/InformationProtectionPoliciesInformationProtectionPolicyName.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/InformationProtectionPoliciesInformationProtectionPolicyName.java new file mode 100644 index 000000000000..172529154647 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/InformationProtectionPoliciesInformationProtectionPolicyName.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for InformationProtectionPoliciesInformationProtectionPolicyName. */ +public final class InformationProtectionPoliciesInformationProtectionPolicyName + extends ExpandableStringEnum { + /** Static value effective for InformationProtectionPoliciesInformationProtectionPolicyName. */ + public static final InformationProtectionPoliciesInformationProtectionPolicyName EFFECTIVE = + fromString("effective"); + + /** Static value custom for InformationProtectionPoliciesInformationProtectionPolicyName. */ + public static final InformationProtectionPoliciesInformationProtectionPolicyName CUSTOM = fromString("custom"); + + /** + * Creates or finds a InformationProtectionPoliciesInformationProtectionPolicyName from its string representation. + * + * @param name a name to look for. + * @return the corresponding InformationProtectionPoliciesInformationProtectionPolicyName. + */ + @JsonCreator + public static InformationProtectionPoliciesInformationProtectionPolicyName fromString(String name) { + return fromString(name, InformationProtectionPoliciesInformationProtectionPolicyName.class); + } + + /** @return known InformationProtectionPoliciesInformationProtectionPolicyName values. */ + public static Collection values() { + return values(InformationProtectionPoliciesInformationProtectionPolicyName.class); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/InformationProtectionPolicy.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/InformationProtectionPolicy.java new file mode 100644 index 000000000000..b145ac417d4b --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/InformationProtectionPolicy.java @@ -0,0 +1,192 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.InformationProtectionPolicyInner; +import java.time.OffsetDateTime; +import java.util.Map; + +/** An immutable client-side representation of InformationProtectionPolicy. */ +public interface InformationProtectionPolicy { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the lastModifiedUtc property: Describes the last UTC time the policy was modified. + * + * @return the lastModifiedUtc value. + */ + OffsetDateTime lastModifiedUtc(); + + /** + * Gets the version property: Describes the version of the policy. + * + * @return the version value. + */ + String version(); + + /** + * Gets the labels property: Dictionary of sensitivity labels. + * + * @return the labels value. + */ + Map labels(); + + /** + * Gets the informationTypes property: The sensitivity information types. + * + * @return the informationTypes value. + */ + Map informationTypes(); + + /** + * Gets the inner com.azure.resourcemanager.security.fluent.models.InformationProtectionPolicyInner object. + * + * @return the inner object. + */ + InformationProtectionPolicyInner innerModel(); + + /** The entirety of the InformationProtectionPolicy definition. */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithScope, DefinitionStages.WithCreate { + } + /** The InformationProtectionPolicy definition stages. */ + interface DefinitionStages { + /** The first stage of the InformationProtectionPolicy definition. */ + interface Blank extends WithScope { + } + /** The stage of the InformationProtectionPolicy definition allowing to specify parent resource. */ + interface WithScope { + /** + * Specifies scope. + * + * @param scope Scope of the query, can be subscription + * (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or management group + * (/providers/Microsoft.Management/managementGroups/mgName). + * @return the next definition stage. + */ + WithCreate withExistingScope(String scope); + } + /** + * The stage of the InformationProtectionPolicy definition which contains all the minimum required properties + * for the resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithLabels, DefinitionStages.WithInformationTypes { + /** + * Executes the create request. + * + * @return the created resource. + */ + InformationProtectionPolicy create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + InformationProtectionPolicy create(Context context); + } + /** The stage of the InformationProtectionPolicy definition allowing to specify labels. */ + interface WithLabels { + /** + * Specifies the labels property: Dictionary of sensitivity labels.. + * + * @param labels Dictionary of sensitivity labels. + * @return the next definition stage. + */ + WithCreate withLabels(Map labels); + } + /** The stage of the InformationProtectionPolicy definition allowing to specify informationTypes. */ + interface WithInformationTypes { + /** + * Specifies the informationTypes property: The sensitivity information types.. + * + * @param informationTypes The sensitivity information types. + * @return the next definition stage. + */ + WithCreate withInformationTypes(Map informationTypes); + } + } + /** + * Begins update for the InformationProtectionPolicy resource. + * + * @return the stage of resource update. + */ + InformationProtectionPolicy.Update update(); + + /** The template for InformationProtectionPolicy update. */ + interface Update extends UpdateStages.WithLabels, UpdateStages.WithInformationTypes { + /** + * Executes the update request. + * + * @return the updated resource. + */ + InformationProtectionPolicy apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + InformationProtectionPolicy apply(Context context); + } + /** The InformationProtectionPolicy update stages. */ + interface UpdateStages { + /** The stage of the InformationProtectionPolicy update allowing to specify labels. */ + interface WithLabels { + /** + * Specifies the labels property: Dictionary of sensitivity labels.. + * + * @param labels Dictionary of sensitivity labels. + * @return the next definition stage. + */ + Update withLabels(Map labels); + } + /** The stage of the InformationProtectionPolicy update allowing to specify informationTypes. */ + interface WithInformationTypes { + /** + * Specifies the informationTypes property: The sensitivity information types.. + * + * @param informationTypes The sensitivity information types. + * @return the next definition stage. + */ + Update withInformationTypes(Map informationTypes); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + InformationProtectionPolicy refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + InformationProtectionPolicy refresh(Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/InformationProtectionPolicyList.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/InformationProtectionPolicyList.java new file mode 100644 index 000000000000..d2665920a5cf --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/InformationProtectionPolicyList.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.models.InformationProtectionPolicyInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Information protection policies response. */ +@Fluent +public final class InformationProtectionPolicyList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(InformationProtectionPolicyList.class); + + /* + * List of information protection policies. + */ + @JsonProperty(value = "value") + private List value; + + /* + * The URI to fetch the next page. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: List of information protection policies. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: List of information protection policies. + * + * @param value the value value to set. + * @return the InformationProtectionPolicyList object itself. + */ + public InformationProtectionPolicyList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The URI to fetch the next page. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/InformationType.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/InformationType.java new file mode 100644 index 000000000000..b2b858ae208c --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/InformationType.java @@ -0,0 +1,211 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.UUID; + +/** The information type. */ +@Fluent +public final class InformationType { + @JsonIgnore private final ClientLogger logger = new ClientLogger(InformationType.class); + + /* + * The name of the information type. + */ + @JsonProperty(value = "displayName") + private String displayName; + + /* + * The description of the information type. + */ + @JsonProperty(value = "description") + private String description; + + /* + * The order of the information type. + */ + @JsonProperty(value = "order") + private Integer order; + + /* + * The recommended label id to be associated with this information type. + */ + @JsonProperty(value = "recommendedLabelId") + private UUID recommendedLabelId; + + /* + * Indicates whether the information type is enabled or not. + */ + @JsonProperty(value = "enabled") + private Boolean enabled; + + /* + * Indicates whether the information type is custom or not. + */ + @JsonProperty(value = "custom") + private Boolean custom; + + /* + * The information type keywords. + */ + @JsonProperty(value = "keywords") + private List keywords; + + /** + * Get the displayName property: The name of the information type. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName property: The name of the information type. + * + * @param displayName the displayName value to set. + * @return the InformationType object itself. + */ + public InformationType withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the description property: The description of the information type. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: The description of the information type. + * + * @param description the description value to set. + * @return the InformationType object itself. + */ + public InformationType withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the order property: The order of the information type. + * + * @return the order value. + */ + public Integer order() { + return this.order; + } + + /** + * Set the order property: The order of the information type. + * + * @param order the order value to set. + * @return the InformationType object itself. + */ + public InformationType withOrder(Integer order) { + this.order = order; + return this; + } + + /** + * Get the recommendedLabelId property: The recommended label id to be associated with this information type. + * + * @return the recommendedLabelId value. + */ + public UUID recommendedLabelId() { + return this.recommendedLabelId; + } + + /** + * Set the recommendedLabelId property: The recommended label id to be associated with this information type. + * + * @param recommendedLabelId the recommendedLabelId value to set. + * @return the InformationType object itself. + */ + public InformationType withRecommendedLabelId(UUID recommendedLabelId) { + this.recommendedLabelId = recommendedLabelId; + return this; + } + + /** + * Get the enabled property: Indicates whether the information type is enabled or not. + * + * @return the enabled value. + */ + public Boolean enabled() { + return this.enabled; + } + + /** + * Set the enabled property: Indicates whether the information type is enabled or not. + * + * @param enabled the enabled value to set. + * @return the InformationType object itself. + */ + public InformationType withEnabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get the custom property: Indicates whether the information type is custom or not. + * + * @return the custom value. + */ + public Boolean custom() { + return this.custom; + } + + /** + * Set the custom property: Indicates whether the information type is custom or not. + * + * @param custom the custom value to set. + * @return the InformationType object itself. + */ + public InformationType withCustom(Boolean custom) { + this.custom = custom; + return this; + } + + /** + * Get the keywords property: The information type keywords. + * + * @return the keywords value. + */ + public List keywords() { + return this.keywords; + } + + /** + * Set the keywords property: The information type keywords. + * + * @param keywords the keywords value to set. + * @return the InformationType object itself. + */ + public InformationType withKeywords(List keywords) { + this.keywords = keywords; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (keywords() != null) { + keywords().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IngestionConnectionString.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IngestionConnectionString.java new file mode 100644 index 000000000000..6b79f73935c8 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IngestionConnectionString.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Connection string for ingesting security data and logs. */ +@Immutable +public final class IngestionConnectionString { + @JsonIgnore private final ClientLogger logger = new ClientLogger(IngestionConnectionString.class); + + /* + * The region where ingested logs and data resides + */ + @JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY) + private String location; + + /* + * Connection string value + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private String value; + + /** + * Get the location property: The region where ingested logs and data resides. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Get the value property: Connection string value. + * + * @return the value value. + */ + public String value() { + return this.value; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IngestionSetting.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IngestionSetting.java new file mode 100644 index 000000000000..5e008a127ba2 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IngestionSetting.java @@ -0,0 +1,141 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.IngestionSettingInner; + +/** An immutable client-side representation of IngestionSetting. */ +public interface IngestionSetting { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the properties property: Ingestion setting data. + * + * @return the properties value. + */ + Object properties(); + + /** + * Gets the inner com.azure.resourcemanager.security.fluent.models.IngestionSettingInner object. + * + * @return the inner object. + */ + IngestionSettingInner innerModel(); + + /** The entirety of the IngestionSetting definition. */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithCreate { + } + /** The IngestionSetting definition stages. */ + interface DefinitionStages { + /** The first stage of the IngestionSetting definition. */ + interface Blank extends WithCreate { + } + /** + * The stage of the IngestionSetting definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithProperties { + /** + * Executes the create request. + * + * @return the created resource. + */ + IngestionSetting create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + IngestionSetting create(Context context); + } + /** The stage of the IngestionSetting definition allowing to specify properties. */ + interface WithProperties { + /** + * Specifies the properties property: Ingestion setting data. + * + * @param properties Ingestion setting data. + * @return the next definition stage. + */ + WithCreate withProperties(Object properties); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + IngestionSetting refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + IngestionSetting refresh(Context context); + + /** + * Returns the token that is used for correlating ingested telemetry with the resources in the subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return configures how to correlate scan data and logs with resources associated with the subscription. + */ + IngestionSettingToken listTokens(); + + /** + * Returns the token that is used for correlating ingested telemetry with the resources in the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return configures how to correlate scan data and logs with resources associated with the subscription. + */ + Response listTokensWithResponse(Context context); + + /** + * Connection strings for ingesting security scan logs and data. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return connection string for ingesting security data and logs. + */ + ConnectionStrings listConnectionStrings(); + + /** + * Connection strings for ingesting security scan logs and data. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return connection string for ingesting security data and logs. + */ + Response listConnectionStringsWithResponse(Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IngestionSettingList.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IngestionSettingList.java new file mode 100644 index 000000000000..4a4ec46d9a5c --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IngestionSettingList.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.models.IngestionSettingInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of ingestion settings. */ +@Immutable +public final class IngestionSettingList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(IngestionSettingList.class); + + /* + * List of ingestion settings + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * The URI to fetch the next page. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: List of ingestion settings. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The URI to fetch the next page. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IngestionSettingToken.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IngestionSettingToken.java new file mode 100644 index 000000000000..2d82c0090921 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IngestionSettingToken.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.resourcemanager.security.fluent.models.IngestionSettingTokenInner; + +/** An immutable client-side representation of IngestionSettingToken. */ +public interface IngestionSettingToken { + /** + * Gets the token property: The token is used for correlating security data and logs with the resources in the + * subscription. + * + * @return the token value. + */ + String token(); + + /** + * Gets the inner com.azure.resourcemanager.security.fluent.models.IngestionSettingTokenInner object. + * + * @return the inner object. + */ + IngestionSettingTokenInner innerModel(); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IngestionSettings.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IngestionSettings.java new file mode 100644 index 000000000000..02efa8a44ab5 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IngestionSettings.java @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of IngestionSettings. */ +public interface IngestionSettings { + /** + * Settings for ingesting security data and logs to correlate with resources associated with the subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of ingestion settings. + */ + PagedIterable list(); + + /** + * Settings for ingesting security data and logs to correlate with resources associated with the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of ingestion settings. + */ + PagedIterable list(Context context); + + /** + * Settings for ingesting security data and logs to correlate with resources associated with the subscription. + * + * @param ingestionSettingName Name of the ingestion setting. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return configures how to correlate scan data and logs with resources associated with the subscription. + */ + IngestionSetting get(String ingestionSettingName); + + /** + * Settings for ingesting security data and logs to correlate with resources associated with the subscription. + * + * @param ingestionSettingName Name of the ingestion setting. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return configures how to correlate scan data and logs with resources associated with the subscription. + */ + Response getWithResponse(String ingestionSettingName, Context context); + + /** + * Deletes the ingestion settings for this subscription. + * + * @param ingestionSettingName Name of the ingestion setting. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String ingestionSettingName); + + /** + * Deletes the ingestion settings for this subscription. + * + * @param ingestionSettingName Name of the ingestion setting. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response deleteWithResponse(String ingestionSettingName, Context context); + + /** + * Returns the token that is used for correlating ingested telemetry with the resources in the subscription. + * + * @param ingestionSettingName Name of the ingestion setting. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return configures how to correlate scan data and logs with resources associated with the subscription. + */ + IngestionSettingToken listTokens(String ingestionSettingName); + + /** + * Returns the token that is used for correlating ingested telemetry with the resources in the subscription. + * + * @param ingestionSettingName Name of the ingestion setting. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return configures how to correlate scan data and logs with resources associated with the subscription. + */ + Response listTokensWithResponse(String ingestionSettingName, Context context); + + /** + * Connection strings for ingesting security scan logs and data. + * + * @param ingestionSettingName Name of the ingestion setting. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return connection string for ingesting security data and logs. + */ + ConnectionStrings listConnectionStrings(String ingestionSettingName); + + /** + * Connection strings for ingesting security scan logs and data. + * + * @param ingestionSettingName Name of the ingestion setting. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return connection string for ingesting security data and logs. + */ + Response listConnectionStringsWithResponse(String ingestionSettingName, Context context); + + /** + * Settings for ingesting security data and logs to correlate with resources associated with the subscription. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return configures how to correlate scan data and logs with resources associated with the subscription. + */ + IngestionSetting getById(String id); + + /** + * Settings for ingesting security data and logs to correlate with resources associated with the subscription. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return configures how to correlate scan data and logs with resources associated with the subscription. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes the ingestion settings for this subscription. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes the ingestion settings for this subscription. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new IngestionSetting resource. + * + * @param name resource name. + * @return the first stage of the new IngestionSetting definition. + */ + IngestionSetting.DefinitionStages.Blank define(String name); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Intent.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Intent.java new file mode 100644 index 000000000000..fe23b83a37ba --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Intent.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for Intent. */ +public final class Intent extends ExpandableStringEnum { + /** Static value Unknown for Intent. */ + public static final Intent UNKNOWN = fromString("Unknown"); + + /** Static value PreAttack for Intent. */ + public static final Intent PRE_ATTACK = fromString("PreAttack"); + + /** Static value InitialAccess for Intent. */ + public static final Intent INITIAL_ACCESS = fromString("InitialAccess"); + + /** Static value Persistence for Intent. */ + public static final Intent PERSISTENCE = fromString("Persistence"); + + /** Static value PrivilegeEscalation for Intent. */ + public static final Intent PRIVILEGE_ESCALATION = fromString("PrivilegeEscalation"); + + /** Static value DefenseEvasion for Intent. */ + public static final Intent DEFENSE_EVASION = fromString("DefenseEvasion"); + + /** Static value CredentialAccess for Intent. */ + public static final Intent CREDENTIAL_ACCESS = fromString("CredentialAccess"); + + /** Static value Discovery for Intent. */ + public static final Intent DISCOVERY = fromString("Discovery"); + + /** Static value LateralMovement for Intent. */ + public static final Intent LATERAL_MOVEMENT = fromString("LateralMovement"); + + /** Static value Execution for Intent. */ + public static final Intent EXECUTION = fromString("Execution"); + + /** Static value Collection for Intent. */ + public static final Intent COLLECTION = fromString("Collection"); + + /** Static value Exfiltration for Intent. */ + public static final Intent EXFILTRATION = fromString("Exfiltration"); + + /** Static value CommandAndControl for Intent. */ + public static final Intent COMMAND_AND_CONTROL = fromString("CommandAndControl"); + + /** Static value Impact for Intent. */ + public static final Intent IMPACT = fromString("Impact"); + + /** Static value Probing for Intent. */ + public static final Intent PROBING = fromString("Probing"); + + /** Static value Exploitation for Intent. */ + public static final Intent EXPLOITATION = fromString("Exploitation"); + + /** + * Creates or finds a Intent from its string representation. + * + * @param name a name to look for. + * @return the corresponding Intent. + */ + @JsonCreator + public static Intent fromString(String name) { + return fromString(name, Intent.class); + } + + /** @return known Intent values. */ + public static Collection values() { + return values(Intent.class); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IoTSecurityAggregatedAlert.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IoTSecurityAggregatedAlert.java new file mode 100644 index 000000000000..acabac8ad9f2 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IoTSecurityAggregatedAlert.java @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.resourcemanager.security.fluent.models.IoTSecurityAggregatedAlertInner; +import java.time.LocalDate; +import java.util.List; +import java.util.Map; + +/** An immutable client-side representation of IoTSecurityAggregatedAlert. */ +public interface IoTSecurityAggregatedAlert { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the alertType property: Name of the alert type. + * + * @return the alertType value. + */ + String alertType(); + + /** + * Gets the alertDisplayName property: Display name of the alert type. + * + * @return the alertDisplayName value. + */ + String alertDisplayName(); + + /** + * Gets the aggregatedDateUtc property: Date of detection. + * + * @return the aggregatedDateUtc value. + */ + LocalDate aggregatedDateUtc(); + + /** + * Gets the vendorName property: Name of the organization that raised the alert. + * + * @return the vendorName value. + */ + String vendorName(); + + /** + * Gets the reportedSeverity property: Assessed alert severity. + * + * @return the reportedSeverity value. + */ + ReportedSeverity reportedSeverity(); + + /** + * Gets the remediationSteps property: Recommended steps for remediation. + * + * @return the remediationSteps value. + */ + String remediationSteps(); + + /** + * Gets the description property: Description of the suspected vulnerability and meaning. + * + * @return the description value. + */ + String description(); + + /** + * Gets the count property: Number of alerts occurrences within the aggregated time window. + * + * @return the count value. + */ + Long count(); + + /** + * Gets the effectedResourceType property: Azure resource ID of the resource that received the alerts. + * + * @return the effectedResourceType value. + */ + String effectedResourceType(); + + /** + * Gets the systemSource property: The type of the alerted resource (Azure, Non-Azure). + * + * @return the systemSource value. + */ + String systemSource(); + + /** + * Gets the actionTaken property: IoT Security solution alert response. + * + * @return the actionTaken value. + */ + String actionTaken(); + + /** + * Gets the logAnalyticsQuery property: Log analytics query for getting the list of affected devices/alerts. + * + * @return the logAnalyticsQuery value. + */ + String logAnalyticsQuery(); + + /** + * Gets the topDevicesList property: 10 devices with the highest number of occurrences of this alert type, on this + * day. + * + * @return the topDevicesList value. + */ + List topDevicesList(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the inner com.azure.resourcemanager.security.fluent.models.IoTSecurityAggregatedAlertInner object. + * + * @return the inner object. + */ + IoTSecurityAggregatedAlertInner innerModel(); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IoTSecurityAggregatedAlertList.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IoTSecurityAggregatedAlertList.java new file mode 100644 index 000000000000..9b5b9f0626cf --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IoTSecurityAggregatedAlertList.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.models.IoTSecurityAggregatedAlertInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of IoT Security solution aggregated alert data. */ +@Fluent +public final class IoTSecurityAggregatedAlertList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(IoTSecurityAggregatedAlertList.class); + + /* + * List of aggregated alerts data. + */ + @JsonProperty(value = "value", required = true) + private List value; + + /* + * When there is too much alert data for one page, use this URI to fetch + * the next page. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: List of aggregated alerts data. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: List of aggregated alerts data. + * + * @param value the value value to set. + * @return the IoTSecurityAggregatedAlertList object itself. + */ + public IoTSecurityAggregatedAlertList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: When there is too much alert data for one page, use this URI to fetch the next page. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property value in model IoTSecurityAggregatedAlertList")); + } else { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IoTSecurityAggregatedAlertPropertiesTopDevicesListItem.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IoTSecurityAggregatedAlertPropertiesTopDevicesListItem.java new file mode 100644 index 000000000000..56b4c6e02cb2 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IoTSecurityAggregatedAlertPropertiesTopDevicesListItem.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The IoTSecurityAggregatedAlertPropertiesTopDevicesListItem model. */ +@Immutable +public final class IoTSecurityAggregatedAlertPropertiesTopDevicesListItem { + @JsonIgnore + private final ClientLogger logger = new ClientLogger(IoTSecurityAggregatedAlertPropertiesTopDevicesListItem.class); + + /* + * Name of the device. + */ + @JsonProperty(value = "deviceId", access = JsonProperty.Access.WRITE_ONLY) + private String deviceId; + + /* + * Number of alerts raised for this device. + */ + @JsonProperty(value = "alertsCount", access = JsonProperty.Access.WRITE_ONLY) + private Long alertsCount; + + /* + * Most recent time this alert was raised for this device, on this day. + */ + @JsonProperty(value = "lastOccurrence", access = JsonProperty.Access.WRITE_ONLY) + private String lastOccurrence; + + /** + * Get the deviceId property: Name of the device. + * + * @return the deviceId value. + */ + public String deviceId() { + return this.deviceId; + } + + /** + * Get the alertsCount property: Number of alerts raised for this device. + * + * @return the alertsCount value. + */ + public Long alertsCount() { + return this.alertsCount; + } + + /** + * Get the lastOccurrence property: Most recent time this alert was raised for this device, on this day. + * + * @return the lastOccurrence value. + */ + public String lastOccurrence() { + return this.lastOccurrence; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IoTSecurityAggregatedRecommendation.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IoTSecurityAggregatedRecommendation.java new file mode 100644 index 000000000000..2913b77d620b --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IoTSecurityAggregatedRecommendation.java @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.resourcemanager.security.fluent.models.IoTSecurityAggregatedRecommendationInner; +import java.util.Map; + +/** An immutable client-side representation of IoTSecurityAggregatedRecommendation. */ +public interface IoTSecurityAggregatedRecommendation { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the recommendationName property: Name of the recommendation. + * + * @return the recommendationName value. + */ + String recommendationName(); + + /** + * Gets the recommendationDisplayName property: Display name of the recommendation type. + * + * @return the recommendationDisplayName value. + */ + String recommendationDisplayName(); + + /** + * Gets the description property: Description of the suspected vulnerability and meaning. + * + * @return the description value. + */ + String description(); + + /** + * Gets the recommendationTypeId property: Recommendation-type GUID. + * + * @return the recommendationTypeId value. + */ + String recommendationTypeId(); + + /** + * Gets the detectedBy property: Name of the organization that made the recommendation. + * + * @return the detectedBy value. + */ + String detectedBy(); + + /** + * Gets the remediationSteps property: Recommended steps for remediation. + * + * @return the remediationSteps value. + */ + String remediationSteps(); + + /** + * Gets the reportedSeverity property: Assessed recommendation severity. + * + * @return the reportedSeverity value. + */ + ReportedSeverity reportedSeverity(); + + /** + * Gets the healthyDevices property: Number of healthy devices within the IoT Security solution. + * + * @return the healthyDevices value. + */ + Long healthyDevices(); + + /** + * Gets the unhealthyDeviceCount property: Number of unhealthy devices within the IoT Security solution. + * + * @return the unhealthyDeviceCount value. + */ + Long unhealthyDeviceCount(); + + /** + * Gets the logAnalyticsQuery property: Log analytics query for getting the list of affected devices/alerts. + * + * @return the logAnalyticsQuery value. + */ + String logAnalyticsQuery(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the inner com.azure.resourcemanager.security.fluent.models.IoTSecurityAggregatedRecommendationInner object. + * + * @return the inner object. + */ + IoTSecurityAggregatedRecommendationInner innerModel(); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IoTSecurityAggregatedRecommendationList.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IoTSecurityAggregatedRecommendationList.java new file mode 100644 index 000000000000..c2de1b672048 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IoTSecurityAggregatedRecommendationList.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.models.IoTSecurityAggregatedRecommendationInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of IoT Security solution aggregated recommendations. */ +@Fluent +public final class IoTSecurityAggregatedRecommendationList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(IoTSecurityAggregatedRecommendationList.class); + + /* + * List of aggregated recommendations data. + */ + @JsonProperty(value = "value", required = true) + private List value; + + /* + * When there is too much alert data for one page, use this URI to fetch + * the next page. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: List of aggregated recommendations data. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: List of aggregated recommendations data. + * + * @param value the value value to set. + * @return the IoTSecurityAggregatedRecommendationList object itself. + */ + public IoTSecurityAggregatedRecommendationList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: When there is too much alert data for one page, use this URI to fetch the next page. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property value in model IoTSecurityAggregatedRecommendationList")); + } else { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IoTSecurityAlertedDevice.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IoTSecurityAlertedDevice.java new file mode 100644 index 000000000000..5fbcdba74a15 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IoTSecurityAlertedDevice.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Statistical information about the number of alerts per device during last set number of days. */ +@Immutable +public final class IoTSecurityAlertedDevice { + @JsonIgnore private final ClientLogger logger = new ClientLogger(IoTSecurityAlertedDevice.class); + + /* + * Device identifier. + */ + @JsonProperty(value = "deviceId", access = JsonProperty.Access.WRITE_ONLY) + private String deviceId; + + /* + * Number of alerts raised for this device. + */ + @JsonProperty(value = "alertsCount", access = JsonProperty.Access.WRITE_ONLY) + private Long alertsCount; + + /** + * Get the deviceId property: Device identifier. + * + * @return the deviceId value. + */ + public String deviceId() { + return this.deviceId; + } + + /** + * Get the alertsCount property: Number of alerts raised for this device. + * + * @return the alertsCount value. + */ + public Long alertsCount() { + return this.alertsCount; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IoTSecurityDeviceAlert.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IoTSecurityDeviceAlert.java new file mode 100644 index 000000000000..c3803dbc047e --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IoTSecurityDeviceAlert.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Statistical information about the number of alerts per alert type during last set number of days. */ +@Immutable +public final class IoTSecurityDeviceAlert { + @JsonIgnore private final ClientLogger logger = new ClientLogger(IoTSecurityDeviceAlert.class); + + /* + * Display name of the alert + */ + @JsonProperty(value = "alertDisplayName", access = JsonProperty.Access.WRITE_ONLY) + private String alertDisplayName; + + /* + * Assessed Alert severity. + */ + @JsonProperty(value = "reportedSeverity", access = JsonProperty.Access.WRITE_ONLY) + private ReportedSeverity reportedSeverity; + + /* + * Number of alerts raised for this alert type. + */ + @JsonProperty(value = "alertsCount", access = JsonProperty.Access.WRITE_ONLY) + private Long alertsCount; + + /** + * Get the alertDisplayName property: Display name of the alert. + * + * @return the alertDisplayName value. + */ + public String alertDisplayName() { + return this.alertDisplayName; + } + + /** + * Get the reportedSeverity property: Assessed Alert severity. + * + * @return the reportedSeverity value. + */ + public ReportedSeverity reportedSeverity() { + return this.reportedSeverity; + } + + /** + * Get the alertsCount property: Number of alerts raised for this alert type. + * + * @return the alertsCount value. + */ + public Long alertsCount() { + return this.alertsCount; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IoTSecurityDeviceRecommendation.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IoTSecurityDeviceRecommendation.java new file mode 100644 index 000000000000..ad004438d419 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IoTSecurityDeviceRecommendation.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Statistical information about the number of recommendations per device, per recommendation type. */ +@Immutable +public final class IoTSecurityDeviceRecommendation { + @JsonIgnore private final ClientLogger logger = new ClientLogger(IoTSecurityDeviceRecommendation.class); + + /* + * Display name of the recommendation. + */ + @JsonProperty(value = "recommendationDisplayName", access = JsonProperty.Access.WRITE_ONLY) + private String recommendationDisplayName; + + /* + * Assessed recommendation severity. + */ + @JsonProperty(value = "reportedSeverity", access = JsonProperty.Access.WRITE_ONLY) + private ReportedSeverity reportedSeverity; + + /* + * Number of devices with this recommendation. + */ + @JsonProperty(value = "devicesCount", access = JsonProperty.Access.WRITE_ONLY) + private Long devicesCount; + + /** + * Get the recommendationDisplayName property: Display name of the recommendation. + * + * @return the recommendationDisplayName value. + */ + public String recommendationDisplayName() { + return this.recommendationDisplayName; + } + + /** + * Get the reportedSeverity property: Assessed recommendation severity. + * + * @return the reportedSeverity value. + */ + public ReportedSeverity reportedSeverity() { + return this.reportedSeverity; + } + + /** + * Get the devicesCount property: Number of devices with this recommendation. + * + * @return the devicesCount value. + */ + public Long devicesCount() { + return this.devicesCount; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IoTSecuritySolutionAnalyticsModel.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IoTSecuritySolutionAnalyticsModel.java new file mode 100644 index 000000000000..e0bd62d8d918 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IoTSecuritySolutionAnalyticsModel.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.resourcemanager.security.fluent.models.IoTSecuritySolutionAnalyticsModelInner; +import java.util.List; + +/** An immutable client-side representation of IoTSecuritySolutionAnalyticsModel. */ +public interface IoTSecuritySolutionAnalyticsModel { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the metrics property: Security analytics of your IoT Security solution. + * + * @return the metrics value. + */ + IoTSeverityMetrics metrics(); + + /** + * Gets the unhealthyDeviceCount property: Number of unhealthy devices within your IoT Security solution. + * + * @return the unhealthyDeviceCount value. + */ + Long unhealthyDeviceCount(); + + /** + * Gets the devicesMetrics property: List of device metrics by the aggregation date. + * + * @return the devicesMetrics value. + */ + List devicesMetrics(); + + /** + * Gets the topAlertedDevices property: List of the 3 devices with the most alerts. + * + * @return the topAlertedDevices value. + */ + List topAlertedDevices(); + + /** + * Gets the mostPrevalentDeviceAlerts property: List of the 3 most prevalent device alerts. + * + * @return the mostPrevalentDeviceAlerts value. + */ + List mostPrevalentDeviceAlerts(); + + /** + * Gets the mostPrevalentDeviceRecommendations property: List of the 3 most prevalent device recommendations. + * + * @return the mostPrevalentDeviceRecommendations value. + */ + List mostPrevalentDeviceRecommendations(); + + /** + * Gets the inner com.azure.resourcemanager.security.fluent.models.IoTSecuritySolutionAnalyticsModelInner object. + * + * @return the inner object. + */ + IoTSecuritySolutionAnalyticsModelInner innerModel(); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IoTSecuritySolutionAnalyticsModelList.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IoTSecuritySolutionAnalyticsModelList.java new file mode 100644 index 000000000000..8e98aa8fd4e6 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IoTSecuritySolutionAnalyticsModelList.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.resourcemanager.security.fluent.models.IoTSecuritySolutionAnalyticsModelListInner; +import java.util.List; + +/** An immutable client-side representation of IoTSecuritySolutionAnalyticsModelList. */ +public interface IoTSecuritySolutionAnalyticsModelList { + /** + * Gets the value property: List of Security analytics of your IoT Security solution. + * + * @return the value value. + */ + List value(); + + /** + * Gets the nextLink property: When there is too much alert data for one page, use this URI to fetch the next page. + * + * @return the nextLink value. + */ + String nextLink(); + + /** + * Gets the inner com.azure.resourcemanager.security.fluent.models.IoTSecuritySolutionAnalyticsModelListInner + * object. + * + * @return the inner object. + */ + IoTSecuritySolutionAnalyticsModelListInner innerModel(); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IoTSecuritySolutionAnalyticsModelPropertiesDevicesMetricsItem.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IoTSecuritySolutionAnalyticsModelPropertiesDevicesMetricsItem.java new file mode 100644 index 000000000000..f637376b087a --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IoTSecuritySolutionAnalyticsModelPropertiesDevicesMetricsItem.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** The IoTSecuritySolutionAnalyticsModelPropertiesDevicesMetricsItem model. */ +@Fluent +public final class IoTSecuritySolutionAnalyticsModelPropertiesDevicesMetricsItem { + @JsonIgnore + private final ClientLogger logger = + new ClientLogger(IoTSecuritySolutionAnalyticsModelPropertiesDevicesMetricsItem.class); + + /* + * Aggregation of IoT Security solution device alert metrics by date. + */ + @JsonProperty(value = "date") + private OffsetDateTime date; + + /* + * Device alert count by severity. + */ + @JsonProperty(value = "devicesMetrics") + private IoTSeverityMetrics devicesMetrics; + + /** + * Get the date property: Aggregation of IoT Security solution device alert metrics by date. + * + * @return the date value. + */ + public OffsetDateTime date() { + return this.date; + } + + /** + * Set the date property: Aggregation of IoT Security solution device alert metrics by date. + * + * @param date the date value to set. + * @return the IoTSecuritySolutionAnalyticsModelPropertiesDevicesMetricsItem object itself. + */ + public IoTSecuritySolutionAnalyticsModelPropertiesDevicesMetricsItem withDate(OffsetDateTime date) { + this.date = date; + return this; + } + + /** + * Get the devicesMetrics property: Device alert count by severity. + * + * @return the devicesMetrics value. + */ + public IoTSeverityMetrics devicesMetrics() { + return this.devicesMetrics; + } + + /** + * Set the devicesMetrics property: Device alert count by severity. + * + * @param devicesMetrics the devicesMetrics value to set. + * @return the IoTSecuritySolutionAnalyticsModelPropertiesDevicesMetricsItem object itself. + */ + public IoTSecuritySolutionAnalyticsModelPropertiesDevicesMetricsItem withDevicesMetrics( + IoTSeverityMetrics devicesMetrics) { + this.devicesMetrics = devicesMetrics; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (devicesMetrics() != null) { + devicesMetrics().validate(); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IoTSecuritySolutionModel.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IoTSecuritySolutionModel.java new file mode 100644 index 000000000000..e950517c6d39 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IoTSecuritySolutionModel.java @@ -0,0 +1,420 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.IoTSecuritySolutionModelInner; +import java.util.List; +import java.util.Map; + +/** An immutable client-side representation of IoTSecuritySolutionModel. */ +public interface IoTSecuritySolutionModel { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The resource location. + * + * @return the location value. + */ + String location(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the workspace property: Workspace resource ID. + * + * @return the workspace value. + */ + String workspace(); + + /** + * Gets the displayName property: Resource display name. + * + * @return the displayName value. + */ + String displayName(); + + /** + * Gets the status property: Status of the IoT Security solution. + * + * @return the status value. + */ + SecuritySolutionStatus status(); + + /** + * Gets the export property: List of additional options for exporting to workspace data. + * + * @return the export value. + */ + List export(); + + /** + * Gets the disabledDataSources property: Disabled data sources. Disabling these data sources compromises the + * system. + * + * @return the disabledDataSources value. + */ + List disabledDataSources(); + + /** + * Gets the iotHubs property: IoT Hub resource IDs. + * + * @return the iotHubs value. + */ + List iotHubs(); + + /** + * Gets the userDefinedResources property: Properties of the IoT Security solution's user defined resources. + * + * @return the userDefinedResources value. + */ + UserDefinedResourcesProperties userDefinedResources(); + + /** + * Gets the autoDiscoveredResources property: List of resources that were automatically discovered as relevant to + * the security solution. + * + * @return the autoDiscoveredResources value. + */ + List autoDiscoveredResources(); + + /** + * Gets the recommendationsConfiguration property: List of the configuration status for each recommendation type. + * + * @return the recommendationsConfiguration value. + */ + List recommendationsConfiguration(); + + /** + * Gets the unmaskedIpLoggingStatus property: Unmasked IP address logging status. + * + * @return the unmaskedIpLoggingStatus value. + */ + UnmaskedIpLoggingStatus unmaskedIpLoggingStatus(); + + /** + * Gets the additionalWorkspaces property: List of additional workspaces. + * + * @return the additionalWorkspaces value. + */ + List additionalWorkspaces(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the inner com.azure.resourcemanager.security.fluent.models.IoTSecuritySolutionModelInner object. + * + * @return the inner object. + */ + IoTSecuritySolutionModelInner innerModel(); + + /** The entirety of the IoTSecuritySolutionModel definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithResourceGroup, DefinitionStages.WithCreate { + } + /** The IoTSecuritySolutionModel definition stages. */ + interface DefinitionStages { + /** The first stage of the IoTSecuritySolutionModel definition. */ + interface Blank extends WithResourceGroup { + } + /** The stage of the IoTSecuritySolutionModel definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + /** + * The stage of the IoTSecuritySolutionModel definition which contains all the minimum required properties for + * the resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithLocation, + DefinitionStages.WithTags, + DefinitionStages.WithWorkspace, + DefinitionStages.WithDisplayName, + DefinitionStages.WithStatus, + DefinitionStages.WithExport, + DefinitionStages.WithDisabledDataSources, + DefinitionStages.WithIotHubs, + DefinitionStages.WithUserDefinedResources, + DefinitionStages.WithRecommendationsConfiguration, + DefinitionStages.WithUnmaskedIpLoggingStatus, + DefinitionStages.WithAdditionalWorkspaces { + /** + * Executes the create request. + * + * @return the created resource. + */ + IoTSecuritySolutionModel create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + IoTSecuritySolutionModel create(Context context); + } + /** The stage of the IoTSecuritySolutionModel definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The resource location. + * @return the next definition stage. + */ + WithCreate withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The resource location. + * @return the next definition stage. + */ + WithCreate withRegion(String location); + } + /** The stage of the IoTSecuritySolutionModel definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + /** The stage of the IoTSecuritySolutionModel definition allowing to specify workspace. */ + interface WithWorkspace { + /** + * Specifies the workspace property: Workspace resource ID. + * + * @param workspace Workspace resource ID. + * @return the next definition stage. + */ + WithCreate withWorkspace(String workspace); + } + /** The stage of the IoTSecuritySolutionModel definition allowing to specify displayName. */ + interface WithDisplayName { + /** + * Specifies the displayName property: Resource display name.. + * + * @param displayName Resource display name. + * @return the next definition stage. + */ + WithCreate withDisplayName(String displayName); + } + /** The stage of the IoTSecuritySolutionModel definition allowing to specify status. */ + interface WithStatus { + /** + * Specifies the status property: Status of the IoT Security solution.. + * + * @param status Status of the IoT Security solution. + * @return the next definition stage. + */ + WithCreate withStatus(SecuritySolutionStatus status); + } + /** The stage of the IoTSecuritySolutionModel definition allowing to specify export. */ + interface WithExport { + /** + * Specifies the export property: List of additional options for exporting to workspace data.. + * + * @param export List of additional options for exporting to workspace data. + * @return the next definition stage. + */ + WithCreate withExport(List export); + } + /** The stage of the IoTSecuritySolutionModel definition allowing to specify disabledDataSources. */ + interface WithDisabledDataSources { + /** + * Specifies the disabledDataSources property: Disabled data sources. Disabling these data sources + * compromises the system.. + * + * @param disabledDataSources Disabled data sources. Disabling these data sources compromises the system. + * @return the next definition stage. + */ + WithCreate withDisabledDataSources(List disabledDataSources); + } + /** The stage of the IoTSecuritySolutionModel definition allowing to specify iotHubs. */ + interface WithIotHubs { + /** + * Specifies the iotHubs property: IoT Hub resource IDs. + * + * @param iotHubs IoT Hub resource IDs. + * @return the next definition stage. + */ + WithCreate withIotHubs(List iotHubs); + } + /** The stage of the IoTSecuritySolutionModel definition allowing to specify userDefinedResources. */ + interface WithUserDefinedResources { + /** + * Specifies the userDefinedResources property: Properties of the IoT Security solution's user defined + * resources.. + * + * @param userDefinedResources Properties of the IoT Security solution's user defined resources. + * @return the next definition stage. + */ + WithCreate withUserDefinedResources(UserDefinedResourcesProperties userDefinedResources); + } + /** The stage of the IoTSecuritySolutionModel definition allowing to specify recommendationsConfiguration. */ + interface WithRecommendationsConfiguration { + /** + * Specifies the recommendationsConfiguration property: List of the configuration status for each + * recommendation type.. + * + * @param recommendationsConfiguration List of the configuration status for each recommendation type. + * @return the next definition stage. + */ + WithCreate withRecommendationsConfiguration( + List recommendationsConfiguration); + } + /** The stage of the IoTSecuritySolutionModel definition allowing to specify unmaskedIpLoggingStatus. */ + interface WithUnmaskedIpLoggingStatus { + /** + * Specifies the unmaskedIpLoggingStatus property: Unmasked IP address logging status. + * + * @param unmaskedIpLoggingStatus Unmasked IP address logging status. + * @return the next definition stage. + */ + WithCreate withUnmaskedIpLoggingStatus(UnmaskedIpLoggingStatus unmaskedIpLoggingStatus); + } + /** The stage of the IoTSecuritySolutionModel definition allowing to specify additionalWorkspaces. */ + interface WithAdditionalWorkspaces { + /** + * Specifies the additionalWorkspaces property: List of additional workspaces. + * + * @param additionalWorkspaces List of additional workspaces. + * @return the next definition stage. + */ + WithCreate withAdditionalWorkspaces(List additionalWorkspaces); + } + } + /** + * Begins update for the IoTSecuritySolutionModel resource. + * + * @return the stage of resource update. + */ + IoTSecuritySolutionModel.Update update(); + + /** The template for IoTSecuritySolutionModel update. */ + interface Update + extends UpdateStages.WithTags, + UpdateStages.WithUserDefinedResources, + UpdateStages.WithRecommendationsConfiguration { + /** + * Executes the update request. + * + * @return the updated resource. + */ + IoTSecuritySolutionModel apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + IoTSecuritySolutionModel apply(Context context); + } + /** The IoTSecuritySolutionModel update stages. */ + interface UpdateStages { + /** The stage of the IoTSecuritySolutionModel update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + /** The stage of the IoTSecuritySolutionModel update allowing to specify userDefinedResources. */ + interface WithUserDefinedResources { + /** + * Specifies the userDefinedResources property: Properties of the IoT Security solution's user defined + * resources.. + * + * @param userDefinedResources Properties of the IoT Security solution's user defined resources. + * @return the next definition stage. + */ + Update withUserDefinedResources(UserDefinedResourcesProperties userDefinedResources); + } + /** The stage of the IoTSecuritySolutionModel update allowing to specify recommendationsConfiguration. */ + interface WithRecommendationsConfiguration { + /** + * Specifies the recommendationsConfiguration property: List of the configuration status for each + * recommendation type.. + * + * @param recommendationsConfiguration List of the configuration status for each recommendation type. + * @return the next definition stage. + */ + Update withRecommendationsConfiguration( + List recommendationsConfiguration); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + IoTSecuritySolutionModel refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + IoTSecuritySolutionModel refresh(Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IoTSecuritySolutionsList.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IoTSecuritySolutionsList.java new file mode 100644 index 000000000000..6616236084e2 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IoTSecuritySolutionsList.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.models.IoTSecuritySolutionModelInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of IoT Security solutions. */ +@Fluent +public final class IoTSecuritySolutionsList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(IoTSecuritySolutionsList.class); + + /* + * List of IoT Security solutions + */ + @JsonProperty(value = "value", required = true) + private List value; + + /* + * The URI to fetch the next page. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: List of IoT Security solutions. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: List of IoT Security solutions. + * + * @param value the value value to set. + * @return the IoTSecuritySolutionsList object itself. + */ + public IoTSecuritySolutionsList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The URI to fetch the next page. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property value in model IoTSecuritySolutionsList")); + } else { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IoTSeverityMetrics.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IoTSeverityMetrics.java new file mode 100644 index 000000000000..398be75027d8 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IoTSeverityMetrics.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** IoT Security solution analytics severity metrics. */ +@Fluent +public final class IoTSeverityMetrics { + @JsonIgnore private final ClientLogger logger = new ClientLogger(IoTSeverityMetrics.class); + + /* + * Count of high severity alerts/recommendations. + */ + @JsonProperty(value = "high") + private Long high; + + /* + * Count of medium severity alerts/recommendations. + */ + @JsonProperty(value = "medium") + private Long medium; + + /* + * Count of low severity alerts/recommendations. + */ + @JsonProperty(value = "low") + private Long low; + + /** + * Get the high property: Count of high severity alerts/recommendations. + * + * @return the high value. + */ + public Long high() { + return this.high; + } + + /** + * Set the high property: Count of high severity alerts/recommendations. + * + * @param high the high value to set. + * @return the IoTSeverityMetrics object itself. + */ + public IoTSeverityMetrics withHigh(Long high) { + this.high = high; + return this; + } + + /** + * Get the medium property: Count of medium severity alerts/recommendations. + * + * @return the medium value. + */ + public Long medium() { + return this.medium; + } + + /** + * Set the medium property: Count of medium severity alerts/recommendations. + * + * @param medium the medium value to set. + * @return the IoTSeverityMetrics object itself. + */ + public IoTSeverityMetrics withMedium(Long medium) { + this.medium = medium; + return this; + } + + /** + * Get the low property: Count of low severity alerts/recommendations. + * + * @return the low value. + */ + public Long low() { + return this.low; + } + + /** + * Set the low property: Count of low severity alerts/recommendations. + * + * @param low the low value to set. + * @return the IoTSeverityMetrics object itself. + */ + public IoTSeverityMetrics withLow(Long low) { + this.low = low; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IotAlertListModel.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IotAlertListModel.java new file mode 100644 index 000000000000..b28c3830e14f --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IotAlertListModel.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.models.IotAlertModelInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of IoT alerts. */ +@Immutable +public final class IotAlertListModel { + @JsonIgnore private final ClientLogger logger = new ClientLogger(IotAlertListModel.class); + + /* + * List data + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * When available, follow the URI to get the next page of data + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: List data. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: When available, follow the URI to get the next page of data. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IotAlertModel.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IotAlertModel.java new file mode 100644 index 000000000000..fec18e0dabcc --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IotAlertModel.java @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.resourcemanager.security.fluent.models.IotAlertModelInner; +import java.util.List; + +/** An immutable client-side representation of IotAlertModel. */ +public interface IotAlertModel { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the systemAlertId property: Holds the product canonical identifier of the alert within the scope of a + * product. + * + * @return the systemAlertId value. + */ + String systemAlertId(); + + /** + * Gets the compromisedEntity property: Display name of the main entity being reported on. + * + * @return the compromisedEntity value. + */ + String compromisedEntity(); + + /** + * Gets the alertType property: The type name of the alert. + * + * @return the alertType value. + */ + String alertType(); + + /** + * Gets the startTimeUtc property: The impact start time of the alert (the time of the first event or activity + * included in the alert). + * + * @return the startTimeUtc value. + */ + String startTimeUtc(); + + /** + * Gets the endTimeUtc property: The impact end time of the alert (the time of the last event or activity included + * in the alert). + * + * @return the endTimeUtc value. + */ + String endTimeUtc(); + + /** + * Gets the entities property: A list of entities related to the alert. + * + * @return the entities value. + */ + List entities(); + + /** + * Gets the extendedProperties property: A bag of fields which extends the alert information. + * + * @return the extendedProperties value. + */ + Object extendedProperties(); + + /** + * Gets the inner com.azure.resourcemanager.security.fluent.models.IotAlertModelInner object. + * + * @return the inner object. + */ + IotAlertModelInner innerModel(); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IotAlertType.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IotAlertType.java new file mode 100644 index 000000000000..8a685cd60ccf --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IotAlertType.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.resourcemanager.security.fluent.models.IotAlertTypeInner; +import java.util.List; + +/** An immutable client-side representation of IotAlertType. */ +public interface IotAlertType { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the alertDisplayName property: The display name of the alert. + * + * @return the alertDisplayName value. + */ + String alertDisplayName(); + + /** + * Gets the severity property: The severity of the alert. + * + * @return the severity value. + */ + AlertSeverity severity(); + + /** + * Gets the description property: Description of the suspected vulnerability and meaning. + * + * @return the description value. + */ + String description(); + + /** + * Gets the providerName property: The name of the alert provider or internal partner. + * + * @return the providerName value. + */ + String providerName(); + + /** + * Gets the productName property: The name of the product which published this alert. + * + * @return the productName value. + */ + String productName(); + + /** + * Gets the productComponentName property: The name of a component inside the product which generated the alert. + * + * @return the productComponentName value. + */ + String productComponentName(); + + /** + * Gets the vendorName property: The name of the vendor that raise the alert. + * + * @return the vendorName value. + */ + String vendorName(); + + /** + * Gets the intent property: Kill chain related intent behind the alert. Could contain multiple enum values + * (separated by commas). + * + * @return the intent value. + */ + AlertIntent intent(); + + /** + * Gets the remediationSteps property: Manual action items to take to remediate the alert. + * + * @return the remediationSteps value. + */ + List remediationSteps(); + + /** + * Gets the inner com.azure.resourcemanager.security.fluent.models.IotAlertTypeInner object. + * + * @return the inner object. + */ + IotAlertTypeInner innerModel(); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IotAlertTypeList.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IotAlertTypeList.java new file mode 100644 index 000000000000..da62daaa422c --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IotAlertTypeList.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.resourcemanager.security.fluent.models.IotAlertTypeListInner; +import java.util.List; + +/** An immutable client-side representation of IotAlertTypeList. */ +public interface IotAlertTypeList { + /** + * Gets the value property: List data. + * + * @return the value value. + */ + List value(); + + /** + * Gets the inner com.azure.resourcemanager.security.fluent.models.IotAlertTypeListInner object. + * + * @return the inner object. + */ + IotAlertTypeListInner innerModel(); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IotAlertTypes.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IotAlertTypes.java new file mode 100644 index 000000000000..a7a8ee28a7d6 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IotAlertTypes.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of IotAlertTypes. */ +public interface IotAlertTypes { + /** + * List IoT alert types. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of alert types. + */ + IotAlertTypeList list(); + + /** + * List IoT alert types. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of alert types. + */ + Response listWithResponse(Context context); + + /** + * Get IoT alert type. + * + * @param iotAlertTypeName Name of the alert type. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT alert type. + */ + IotAlertType get(String iotAlertTypeName); + + /** + * Get IoT alert type. + * + * @param iotAlertTypeName Name of the alert type. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT alert type. + */ + Response getWithResponse(String iotAlertTypeName, Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IotAlerts.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IotAlerts.java new file mode 100644 index 000000000000..66911a0a93f8 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IotAlerts.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of IotAlerts. */ +public interface IotAlerts { + /** + * List IoT alerts. + * + * @param scope Scope of the query: Subscription (i.e. /subscriptions/{subscriptionId}) or IoT Hub (i.e. + * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Devices/iotHubs/{iotHubName}). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of IoT alerts. + */ + PagedIterable list(String scope); + + /** + * List IoT alerts. + * + * @param scope Scope of the query: Subscription (i.e. /subscriptions/{subscriptionId}) or IoT Hub (i.e. + * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Devices/iotHubs/{iotHubName}). + * @param minStartTimeUtc Filter by minimum startTimeUtc (ISO 8601 format). + * @param maxStartTimeUtc Filter by maximum startTimeUtc (ISO 8601 format). + * @param alertType Filter by alert type. + * @param deviceManagementType Get devices only from specific type, Managed or Unmanaged. + * @param compromisedEntity Filter by compromised device. + * @param limit Limit the number of items returned in a single page. + * @param skipToken Skip token used for pagination. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of IoT alerts. + */ + PagedIterable list( + String scope, + String minStartTimeUtc, + String maxStartTimeUtc, + String alertType, + ManagementState deviceManagementType, + String compromisedEntity, + Integer limit, + String skipToken, + Context context); + + /** + * Get IoT alert. + * + * @param scope Scope of the query: Subscription (i.e. /subscriptions/{subscriptionId}) or IoT Hub (i.e. + * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Devices/iotHubs/{iotHubName}). + * @param iotAlertId Id of the alert. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT alert. + */ + IotAlertModel get(String scope, String iotAlertId); + + /** + * Get IoT alert. + * + * @param scope Scope of the query: Subscription (i.e. /subscriptions/{subscriptionId}) or IoT Hub (i.e. + * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Devices/iotHubs/{iotHubName}). + * @param iotAlertId Id of the alert. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT alert. + */ + Response getWithResponse(String scope, String iotAlertId, Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IotDefenderSettings.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IotDefenderSettings.java new file mode 100644 index 000000000000..3d65b1674e48 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IotDefenderSettings.java @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.StreamResponse; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.IotDefenderSettingsModelInner; +import java.io.InputStream; + +/** Resource collection API of IotDefenderSettings. */ +public interface IotDefenderSettings { + /** + * List IoT Defender Settings. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of IoT Defender settings. + */ + IotDefenderSettingsList list(); + + /** + * List IoT Defender Settings. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of IoT Defender settings. + */ + Response listWithResponse(Context context); + + /** + * Get IoT Defender Settings. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT Defender Settings. + */ + IotDefenderSettingsModel get(); + + /** + * Get IoT Defender Settings. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT Defender Settings. + */ + Response getWithResponse(Context context); + + /** + * Create or update IoT Defender settings. + * + * @param iotDefenderSettingsModel The IoT defender settings model. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT Defender settings. + */ + IotDefenderSettingsModel createOrUpdate(IotDefenderSettingsModelInner iotDefenderSettingsModel); + + /** + * Create or update IoT Defender settings. + * + * @param iotDefenderSettingsModel The IoT defender settings model. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT Defender settings. + */ + Response createOrUpdateWithResponse( + IotDefenderSettingsModelInner iotDefenderSettingsModel, Context context); + + /** + * Delete IoT Defender settings. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(); + + /** + * Delete IoT Defender settings. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response deleteWithResponse(Context context); + + /** + * Information about downloadable packages. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about package downloads. + */ + PackageDownloads packageDownloads(); + + /** + * Information about downloadable packages. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about package downloads. + */ + Response packageDownloadsWithResponse(Context context); + + /** + * Download manager activation data defined for this subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + InputStream downloadManagerActivation(); + + /** + * Download manager activation data defined for this subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + StreamResponse downloadManagerActivationWithResponse(Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IotDefenderSettingsList.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IotDefenderSettingsList.java new file mode 100644 index 000000000000..5c6269219dfb --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IotDefenderSettingsList.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.resourcemanager.security.fluent.models.IotDefenderSettingsListInner; +import java.util.List; + +/** An immutable client-side representation of IotDefenderSettingsList. */ +public interface IotDefenderSettingsList { + /** + * Gets the value property: List data. + * + * @return the value value. + */ + List value(); + + /** + * Gets the inner com.azure.resourcemanager.security.fluent.models.IotDefenderSettingsListInner object. + * + * @return the inner object. + */ + IotDefenderSettingsListInner innerModel(); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IotDefenderSettingsModel.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IotDefenderSettingsModel.java new file mode 100644 index 000000000000..0ea1211c2022 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IotDefenderSettingsModel.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.resourcemanager.security.fluent.models.IotDefenderSettingsModelInner; +import java.time.OffsetDateTime; +import java.util.List; + +/** An immutable client-side representation of IotDefenderSettingsModel. */ +public interface IotDefenderSettingsModel { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the deviceQuota property: Size of the device quota (as a opposed to a Pay as You Go billing model). Value is + * required to be in multiples of 1000. + * + * @return the deviceQuota value. + */ + Integer deviceQuota(); + + /** + * Gets the sentinelWorkspaceResourceIds property: Sentinel Workspace Resource Ids. + * + * @return the sentinelWorkspaceResourceIds value. + */ + List sentinelWorkspaceResourceIds(); + + /** + * Gets the onboardingKind property: The kind of onboarding for the subscription. + * + * @return the onboardingKind value. + */ + OnboardingKind onboardingKind(); + + /** + * Gets the evaluationEndTime property: End time of the evaluation period, if such exist. + * + * @return the evaluationEndTime value. + */ + OffsetDateTime evaluationEndTime(); + + /** + * Gets the inner com.azure.resourcemanager.security.fluent.models.IotDefenderSettingsModelInner object. + * + * @return the inner object. + */ + IotDefenderSettingsModelInner innerModel(); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IotRecommendationListModel.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IotRecommendationListModel.java new file mode 100644 index 000000000000..d4120658d875 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IotRecommendationListModel.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.models.IotRecommendationModelInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of IoT recommendations. */ +@Immutable +public final class IotRecommendationListModel { + @JsonIgnore private final ClientLogger logger = new ClientLogger(IotRecommendationListModel.class); + + /* + * List data + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * When available, follow the URI to get the next page of data + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: List data. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: When available, follow the URI to get the next page of data. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IotRecommendationModel.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IotRecommendationModel.java new file mode 100644 index 000000000000..b9d958d5f5b7 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IotRecommendationModel.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.resourcemanager.security.fluent.models.IotRecommendationModelInner; + +/** An immutable client-side representation of IotRecommendationModel. */ +public interface IotRecommendationModel { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the deviceId property: Identifier of the device being reported on. + * + * @return the deviceId value. + */ + String deviceId(); + + /** + * Gets the recommendationType property: The type name of the recommendation. + * + * @return the recommendationType value. + */ + String recommendationType(); + + /** + * Gets the discoveredTimeUtc property: The discovery time of the recommendation. + * + * @return the discoveredTimeUtc value. + */ + String discoveredTimeUtc(); + + /** + * Gets the recommendationAdditionalData property: A bag of fields which extends the recommendation information. + * + * @return the recommendationAdditionalData value. + */ + Object recommendationAdditionalData(); + + /** + * Gets the inner com.azure.resourcemanager.security.fluent.models.IotRecommendationModelInner object. + * + * @return the inner object. + */ + IotRecommendationModelInner innerModel(); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IotRecommendationType.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IotRecommendationType.java new file mode 100644 index 000000000000..62d8be131c2d --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IotRecommendationType.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.resourcemanager.security.fluent.models.IotRecommendationTypeInner; +import java.util.List; + +/** An immutable client-side representation of IotRecommendationType. */ +public interface IotRecommendationType { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the recommendationDisplayName property: The display name of the recommendation. + * + * @return the recommendationDisplayName value. + */ + String recommendationDisplayName(); + + /** + * Gets the severity property: The severity of the recommendation. + * + * @return the severity value. + */ + RecommendationSeverity severity(); + + /** + * Gets the description property: Description of the suspected vulnerability and meaning. + * + * @return the description value. + */ + String description(); + + /** + * Gets the productName property: The name of the product which published this recommendation. + * + * @return the productName value. + */ + String productName(); + + /** + * Gets the productComponentName property: The name of a component inside the product which generated the + * recommendation. + * + * @return the productComponentName value. + */ + String productComponentName(); + + /** + * Gets the vendorName property: The name of the vendor that raised the recommendation. + * + * @return the vendorName value. + */ + String vendorName(); + + /** + * Gets the control property: The name of the recommendation's control category. + * + * @return the control value. + */ + String control(); + + /** + * Gets the remediationSteps property: Manual action items to take to resolve the recommendation. + * + * @return the remediationSteps value. + */ + List remediationSteps(); + + /** + * Gets the dataSource property: The alert's data source. + * + * @return the dataSource value. + */ + String dataSource(); + + /** + * Gets the inner com.azure.resourcemanager.security.fluent.models.IotRecommendationTypeInner object. + * + * @return the inner object. + */ + IotRecommendationTypeInner innerModel(); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IotRecommendationTypeList.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IotRecommendationTypeList.java new file mode 100644 index 000000000000..40e74c69e017 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IotRecommendationTypeList.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.resourcemanager.security.fluent.models.IotRecommendationTypeListInner; +import java.util.List; + +/** An immutable client-side representation of IotRecommendationTypeList. */ +public interface IotRecommendationTypeList { + /** + * Gets the value property: List data. + * + * @return the value value. + */ + List value(); + + /** + * Gets the inner com.azure.resourcemanager.security.fluent.models.IotRecommendationTypeListInner object. + * + * @return the inner object. + */ + IotRecommendationTypeListInner innerModel(); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IotRecommendationTypes.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IotRecommendationTypes.java new file mode 100644 index 000000000000..e0fb570ca48c --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IotRecommendationTypes.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of IotRecommendationTypes. */ +public interface IotRecommendationTypes { + /** + * List IoT recommendation types. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of recommendation types. + */ + IotRecommendationTypeList list(); + + /** + * List IoT recommendation types. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of recommendation types. + */ + Response listWithResponse(Context context); + + /** + * Get IoT recommendation type. + * + * @param iotRecommendationTypeName Name of the recommendation type. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT recommendation type. + */ + IotRecommendationType get(String iotRecommendationTypeName); + + /** + * Get IoT recommendation type. + * + * @param iotRecommendationTypeName Name of the recommendation type. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT recommendation type. + */ + Response getWithResponse(String iotRecommendationTypeName, Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IotRecommendations.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IotRecommendations.java new file mode 100644 index 000000000000..f0769d010d28 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IotRecommendations.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of IotRecommendations. */ +public interface IotRecommendations { + /** + * List IoT recommendations. + * + * @param scope Scope of the query: Subscription (i.e. /subscriptions/{subscriptionId}) or IoT Hub (i.e. + * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Devices/iotHubs/{iotHubName}). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of IoT recommendations. + */ + PagedIterable list(String scope); + + /** + * List IoT recommendations. + * + * @param scope Scope of the query: Subscription (i.e. /subscriptions/{subscriptionId}) or IoT Hub (i.e. + * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Devices/iotHubs/{iotHubName}). + * @param recommendationType Filter by recommendation type. + * @param deviceId Filter by device id. + * @param limit Limit the number of items returned in a single page. + * @param skipToken Skip token used for pagination. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of IoT recommendations. + */ + PagedIterable list( + String scope, String recommendationType, String deviceId, Integer limit, String skipToken, Context context); + + /** + * Get IoT recommendation. + * + * @param scope Scope of the query: Subscription (i.e. /subscriptions/{subscriptionId}) or IoT Hub (i.e. + * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Devices/iotHubs/{iotHubName}). + * @param iotRecommendationId Id of the recommendation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT recommendation. + */ + IotRecommendationModel get(String scope, String iotRecommendationId); + + /** + * Get IoT recommendation. + * + * @param scope Scope of the query: Subscription (i.e. /subscriptions/{subscriptionId}) or IoT Hub (i.e. + * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Devices/iotHubs/{iotHubName}). + * @param iotRecommendationId Id of the recommendation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT recommendation. + */ + Response getWithResponse(String scope, String iotRecommendationId, Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IotSecuritySolutionAnalytics.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IotSecuritySolutionAnalytics.java new file mode 100644 index 000000000000..7c73ff3c953f --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IotSecuritySolutionAnalytics.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of IotSecuritySolutionAnalytics. */ +public interface IotSecuritySolutionAnalytics { + /** + * Use this method to get IoT security Analytics metrics in an array. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param solutionName The name of the IoT Security solution. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Security analytics of your IoT Security solution. + */ + IoTSecuritySolutionAnalyticsModelList list(String resourceGroupName, String solutionName); + + /** + * Use this method to get IoT security Analytics metrics in an array. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param solutionName The name of the IoT Security solution. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Security analytics of your IoT Security solution. + */ + Response listWithResponse( + String resourceGroupName, String solutionName, Context context); + + /** + * Use this method to get IoT Security Analytics metrics. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param solutionName The name of the IoT Security solution. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return security analytics of your IoT Security solution. + */ + IoTSecuritySolutionAnalyticsModel get(String resourceGroupName, String solutionName); + + /** + * Use this method to get IoT Security Analytics metrics. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param solutionName The name of the IoT Security solution. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return security analytics of your IoT Security solution. + */ + Response getWithResponse( + String resourceGroupName, String solutionName, Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IotSecuritySolutions.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IotSecuritySolutions.java new file mode 100644 index 000000000000..67d78e962792 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IotSecuritySolutions.java @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of IotSecuritySolutions. */ +public interface IotSecuritySolutions { + /** + * Use this method to get the list of IoT Security solutions by subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of IoT Security solutions. + */ + PagedIterable list(); + + /** + * Use this method to get the list of IoT Security solutions by subscription. + * + * @param filter Filter the IoT Security solution with OData syntax. Supports filtering by iotHubs. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of IoT Security solutions. + */ + PagedIterable list(String filter, Context context); + + /** + * Use this method to get the list IoT Security solutions organized by resource group. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of IoT Security solutions. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Use this method to get the list IoT Security solutions organized by resource group. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param filter Filter the IoT Security solution with OData syntax. Supports filtering by iotHubs. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of IoT Security solutions. + */ + PagedIterable listByResourceGroup( + String resourceGroupName, String filter, Context context); + + /** + * User this method to get details of a specific IoT Security solution based on solution name. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param solutionName The name of the IoT Security solution. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT Security solution configuration and resource information. + */ + IoTSecuritySolutionModel getByResourceGroup(String resourceGroupName, String solutionName); + + /** + * User this method to get details of a specific IoT Security solution based on solution name. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param solutionName The name of the IoT Security solution. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT Security solution configuration and resource information. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, String solutionName, Context context); + + /** + * Use this method to delete yours IoT Security solution. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param solutionName The name of the IoT Security solution. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup(String resourceGroupName, String solutionName); + + /** + * Use this method to delete yours IoT Security solution. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param solutionName The name of the IoT Security solution. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response deleteWithResponse(String resourceGroupName, String solutionName, Context context); + + /** + * User this method to get details of a specific IoT Security solution based on solution name. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT Security solution configuration and resource information. + */ + IoTSecuritySolutionModel getById(String id); + + /** + * User this method to get details of a specific IoT Security solution based on solution name. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT Security solution configuration and resource information. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Use this method to delete yours IoT Security solution. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Use this method to delete yours IoT Security solution. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new IoTSecuritySolutionModel resource. + * + * @param name resource name. + * @return the first stage of the new IoTSecuritySolutionModel definition. + */ + IoTSecuritySolutionModel.DefinitionStages.Blank define(String name); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IotSecuritySolutionsAnalyticsAggregatedAlerts.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IotSecuritySolutionsAnalyticsAggregatedAlerts.java new file mode 100644 index 000000000000..8e6215c4d61f --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IotSecuritySolutionsAnalyticsAggregatedAlerts.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of IotSecuritySolutionsAnalyticsAggregatedAlerts. */ +public interface IotSecuritySolutionsAnalyticsAggregatedAlerts { + /** + * Use this method to get the aggregated alert list of yours IoT Security solution. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param solutionName The name of the IoT Security solution. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of IoT Security solution aggregated alert data. + */ + PagedIterable list(String resourceGroupName, String solutionName); + + /** + * Use this method to get the aggregated alert list of yours IoT Security solution. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param solutionName The name of the IoT Security solution. + * @param top Number of results to retrieve. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of IoT Security solution aggregated alert data. + */ + PagedIterable list( + String resourceGroupName, String solutionName, Integer top, Context context); + + /** + * Use this method to get a single the aggregated alert of yours IoT Security solution. This aggregation is + * performed by alert name. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param solutionName The name of the IoT Security solution. + * @param aggregatedAlertName Identifier of the aggregated alert. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return security Solution Aggregated Alert information. + */ + IoTSecurityAggregatedAlert get(String resourceGroupName, String solutionName, String aggregatedAlertName); + + /** + * Use this method to get a single the aggregated alert of yours IoT Security solution. This aggregation is + * performed by alert name. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param solutionName The name of the IoT Security solution. + * @param aggregatedAlertName Identifier of the aggregated alert. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return security Solution Aggregated Alert information. + */ + Response getWithResponse( + String resourceGroupName, String solutionName, String aggregatedAlertName, Context context); + + /** + * Use this method to dismiss an aggregated IoT Security Solution Alert. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param solutionName The name of the IoT Security solution. + * @param aggregatedAlertName Identifier of the aggregated alert. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void dismiss(String resourceGroupName, String solutionName, String aggregatedAlertName); + + /** + * Use this method to dismiss an aggregated IoT Security Solution Alert. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param solutionName The name of the IoT Security solution. + * @param aggregatedAlertName Identifier of the aggregated alert. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response dismissWithResponse( + String resourceGroupName, String solutionName, String aggregatedAlertName, Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IotSecuritySolutionsAnalyticsRecommendations.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IotSecuritySolutionsAnalyticsRecommendations.java new file mode 100644 index 000000000000..79712ae84b94 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IotSecuritySolutionsAnalyticsRecommendations.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of IotSecuritySolutionsAnalyticsRecommendations. */ +public interface IotSecuritySolutionsAnalyticsRecommendations { + /** + * Use this method to get the aggregated security analytics recommendation of yours IoT Security solution. This + * aggregation is performed by recommendation name. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param solutionName The name of the IoT Security solution. + * @param aggregatedRecommendationName Name of the recommendation aggregated for this query. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT Security solution recommendation information. + */ + IoTSecurityAggregatedRecommendation get( + String resourceGroupName, String solutionName, String aggregatedRecommendationName); + + /** + * Use this method to get the aggregated security analytics recommendation of yours IoT Security solution. This + * aggregation is performed by recommendation name. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param solutionName The name of the IoT Security solution. + * @param aggregatedRecommendationName Name of the recommendation aggregated for this query. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT Security solution recommendation information. + */ + Response getWithResponse( + String resourceGroupName, String solutionName, String aggregatedRecommendationName, Context context); + + /** + * Use this method to get the list of aggregated security analytics recommendations of yours IoT Security solution. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param solutionName The name of the IoT Security solution. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of IoT Security solution aggregated recommendations. + */ + PagedIterable list(String resourceGroupName, String solutionName); + + /** + * Use this method to get the list of aggregated security analytics recommendations of yours IoT Security solution. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param solutionName The name of the IoT Security solution. + * @param top Number of results to retrieve. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of IoT Security solution aggregated recommendations. + */ + PagedIterable list( + String resourceGroupName, String solutionName, Integer top, Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IotSensors.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IotSensors.java new file mode 100644 index 000000000000..917b57deb6b4 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IotSensors.java @@ -0,0 +1,215 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.StreamResponse; +import com.azure.core.util.Context; +import java.io.InputStream; + +/** Resource collection API of IotSensors. */ +public interface IotSensors { + /** + * List IoT sensors. + * + * @param scope Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of IoT sensors. + */ + IotSensorsList list(String scope); + + /** + * List IoT sensors. + * + * @param scope Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of IoT sensors. + */ + Response listWithResponse(String scope, Context context); + + /** + * Get IoT sensor. + * + * @param scope Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub). + * @param iotSensorName Name of the IoT sensor. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT sensor. + */ + IotSensorsModel get(String scope, String iotSensorName); + + /** + * Get IoT sensor. + * + * @param scope Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub). + * @param iotSensorName Name of the IoT sensor. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT sensor. + */ + Response getWithResponse(String scope, String iotSensorName, Context context); + + /** + * Delete IoT sensor. + * + * @param scope Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub). + * @param iotSensorName Name of the IoT sensor. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup(String scope, String iotSensorName); + + /** + * Delete IoT sensor. + * + * @param scope Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub). + * @param iotSensorName Name of the IoT sensor. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response deleteWithResponse(String scope, String iotSensorName, Context context); + + /** + * Download sensor activation file. + * + * @param scope Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub). + * @param iotSensorName Name of the IoT sensor. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + InputStream downloadActivation(String scope, String iotSensorName); + + /** + * Download sensor activation file. + * + * @param scope Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub). + * @param iotSensorName Name of the IoT sensor. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + StreamResponse downloadActivationWithResponse(String scope, String iotSensorName, Context context); + + /** + * Download file for reset password of the sensor. + * + * @param scope Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub). + * @param iotSensorName Name of the IoT sensor. + * @param body The reset password input. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + InputStream downloadResetPassword(String scope, String iotSensorName, ResetPasswordInput body); + + /** + * Download file for reset password of the sensor. + * + * @param scope Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub). + * @param iotSensorName Name of the IoT sensor. + * @param body The reset password input. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + StreamResponse downloadResetPasswordWithResponse( + String scope, String iotSensorName, ResetPasswordInput body, Context context); + + /** + * Trigger threat intelligence package update. + * + * @param scope Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub). + * @param iotSensorName Name of the IoT sensor. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void triggerTiPackageUpdate(String scope, String iotSensorName); + + /** + * Trigger threat intelligence package update. + * + * @param scope Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub). + * @param iotSensorName Name of the IoT sensor. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response triggerTiPackageUpdateWithResponse(String scope, String iotSensorName, Context context); + + /** + * Get IoT sensor. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT sensor. + */ + IotSensorsModel getById(String id); + + /** + * Get IoT sensor. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT sensor. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete IoT sensor. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Delete IoT sensor. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new IotSensorsModel resource. + * + * @param name resource name. + * @return the first stage of the new IotSensorsModel definition. + */ + IotSensorsModel.DefinitionStages.Blank define(String name); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IotSensorsList.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IotSensorsList.java new file mode 100644 index 000000000000..90434ffaf7d6 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IotSensorsList.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.resourcemanager.security.fluent.models.IotSensorsListInner; +import java.util.List; + +/** An immutable client-side representation of IotSensorsList. */ +public interface IotSensorsList { + /** + * Gets the value property: List data. + * + * @return the value value. + */ + List value(); + + /** + * Gets the inner com.azure.resourcemanager.security.fluent.models.IotSensorsListInner object. + * + * @return the inner object. + */ + IotSensorsListInner innerModel(); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IotSensorsModel.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IotSensorsModel.java new file mode 100644 index 000000000000..866e912fe7f1 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IotSensorsModel.java @@ -0,0 +1,325 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.StreamResponse; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.IotSensorsModelInner; +import java.io.InputStream; + +/** An immutable client-side representation of IotSensorsModel. */ +public interface IotSensorsModel { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the connectivityTime property: Last connectivity time of the IoT sensor. + * + * @return the connectivityTime value. + */ + String connectivityTime(); + + /** + * Gets the creationTime property: Creation time of the IoT sensor. + * + * @return the creationTime value. + */ + String creationTime(); + + /** + * Gets the dynamicLearning property: Dynamic mode status of the IoT sensor. + * + * @return the dynamicLearning value. + */ + Boolean dynamicLearning(); + + /** + * Gets the learningMode property: Learning mode status of the IoT sensor. + * + * @return the learningMode value. + */ + Boolean learningMode(); + + /** + * Gets the sensorStatus property: Status of the IoT sensor. + * + * @return the sensorStatus value. + */ + SensorStatus sensorStatus(); + + /** + * Gets the sensorVersion property: Version of the IoT sensor. + * + * @return the sensorVersion value. + */ + String sensorVersion(); + + /** + * Gets the tiAutomaticUpdates property: TI Automatic mode status of the IoT sensor. + * + * @return the tiAutomaticUpdates value. + */ + Boolean tiAutomaticUpdates(); + + /** + * Gets the tiStatus property: TI Status of the IoT sensor. + * + * @return the tiStatus value. + */ + TiStatus tiStatus(); + + /** + * Gets the tiVersion property: TI Version of the IoT sensor. + * + * @return the tiVersion value. + */ + String tiVersion(); + + /** + * Gets the zone property: Zone of the IoT sensor. + * + * @return the zone value. + */ + String zone(); + + /** + * Gets the sensorType property: Type of sensor. + * + * @return the sensorType value. + */ + SensorType sensorType(); + + /** + * Gets the inner com.azure.resourcemanager.security.fluent.models.IotSensorsModelInner object. + * + * @return the inner object. + */ + IotSensorsModelInner innerModel(); + + /** The entirety of the IotSensorsModel definition. */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithScope, DefinitionStages.WithCreate { + } + /** The IotSensorsModel definition stages. */ + interface DefinitionStages { + /** The first stage of the IotSensorsModel definition. */ + interface Blank extends WithScope { + } + /** The stage of the IotSensorsModel definition allowing to specify parent resource. */ + interface WithScope { + /** + * Specifies scope. + * + * @param scope Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub). + * @return the next definition stage. + */ + WithCreate withExistingScope(String scope); + } + /** + * The stage of the IotSensorsModel definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithTiAutomaticUpdates, + DefinitionStages.WithZone, + DefinitionStages.WithSensorType { + /** + * Executes the create request. + * + * @return the created resource. + */ + IotSensorsModel create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + IotSensorsModel create(Context context); + } + /** The stage of the IotSensorsModel definition allowing to specify tiAutomaticUpdates. */ + interface WithTiAutomaticUpdates { + /** + * Specifies the tiAutomaticUpdates property: TI Automatic mode status of the IoT sensor. + * + * @param tiAutomaticUpdates TI Automatic mode status of the IoT sensor. + * @return the next definition stage. + */ + WithCreate withTiAutomaticUpdates(Boolean tiAutomaticUpdates); + } + /** The stage of the IotSensorsModel definition allowing to specify zone. */ + interface WithZone { + /** + * Specifies the zone property: Zone of the IoT sensor. + * + * @param zone Zone of the IoT sensor. + * @return the next definition stage. + */ + WithCreate withZone(String zone); + } + /** The stage of the IotSensorsModel definition allowing to specify sensorType. */ + interface WithSensorType { + /** + * Specifies the sensorType property: Type of sensor. + * + * @param sensorType Type of sensor. + * @return the next definition stage. + */ + WithCreate withSensorType(SensorType sensorType); + } + } + /** + * Begins update for the IotSensorsModel resource. + * + * @return the stage of resource update. + */ + IotSensorsModel.Update update(); + + /** The template for IotSensorsModel update. */ + interface Update extends UpdateStages.WithTiAutomaticUpdates, UpdateStages.WithZone, UpdateStages.WithSensorType { + /** + * Executes the update request. + * + * @return the updated resource. + */ + IotSensorsModel apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + IotSensorsModel apply(Context context); + } + /** The IotSensorsModel update stages. */ + interface UpdateStages { + /** The stage of the IotSensorsModel update allowing to specify tiAutomaticUpdates. */ + interface WithTiAutomaticUpdates { + /** + * Specifies the tiAutomaticUpdates property: TI Automatic mode status of the IoT sensor. + * + * @param tiAutomaticUpdates TI Automatic mode status of the IoT sensor. + * @return the next definition stage. + */ + Update withTiAutomaticUpdates(Boolean tiAutomaticUpdates); + } + /** The stage of the IotSensorsModel update allowing to specify zone. */ + interface WithZone { + /** + * Specifies the zone property: Zone of the IoT sensor. + * + * @param zone Zone of the IoT sensor. + * @return the next definition stage. + */ + Update withZone(String zone); + } + /** The stage of the IotSensorsModel update allowing to specify sensorType. */ + interface WithSensorType { + /** + * Specifies the sensorType property: Type of sensor. + * + * @param sensorType Type of sensor. + * @return the next definition stage. + */ + Update withSensorType(SensorType sensorType); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + IotSensorsModel refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + IotSensorsModel refresh(Context context); + + /** + * Download sensor activation file. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + InputStream downloadActivation(); + + /** + * Download sensor activation file. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + StreamResponse downloadActivationWithResponse(Context context); + + /** + * Download file for reset password of the sensor. + * + * @param body The reset password input. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + InputStream downloadResetPassword(ResetPasswordInput body); + + /** + * Download file for reset password of the sensor. + * + * @param body The reset password input. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + StreamResponse downloadResetPasswordWithResponse(ResetPasswordInput body, Context context); + + /** + * Trigger threat intelligence package update. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void triggerTiPackageUpdate(); + + /** + * Trigger threat intelligence package update. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response triggerTiPackageUpdateWithResponse(Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IotSites.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IotSites.java new file mode 100644 index 000000000000..e2328a0f13a4 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IotSites.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.IotSitesModelInner; + +/** Resource collection API of IotSites. */ +public interface IotSites { + /** + * List IoT sites. + * + * @param scope Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of IoT sites. + */ + IotSitesList list(String scope); + + /** + * List IoT sites. + * + * @param scope Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of IoT sites. + */ + Response listWithResponse(String scope, Context context); + + /** + * Get IoT site. + * + * @param scope Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT site. + */ + IotSitesModel get(String scope); + + /** + * Get IoT site. + * + * @param scope Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT site. + */ + Response getWithResponse(String scope, Context context); + + /** + * Create or update IoT site. + * + * @param scope Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub). + * @param iotSitesModel The IoT sites model. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT site model. + */ + IotSitesModel createOrUpdate(String scope, IotSitesModelInner iotSitesModel); + + /** + * Create or update IoT site. + * + * @param scope Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub). + * @param iotSitesModel The IoT sites model. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return ioT site model. + */ + Response createOrUpdateWithResponse(String scope, IotSitesModelInner iotSitesModel, Context context); + + /** + * Delete IoT site. + * + * @param scope Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String scope); + + /** + * Delete IoT site. + * + * @param scope Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response deleteWithResponse(String scope, Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IotSitesList.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IotSitesList.java new file mode 100644 index 000000000000..f21b8fa26903 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IotSitesList.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.resourcemanager.security.fluent.models.IotSitesListInner; +import java.util.List; + +/** An immutable client-side representation of IotSitesList. */ +public interface IotSitesList { + /** + * Gets the value property: List data. + * + * @return the value value. + */ + List value(); + + /** + * Gets the inner com.azure.resourcemanager.security.fluent.models.IotSitesListInner object. + * + * @return the inner object. + */ + IotSitesListInner innerModel(); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IotSitesModel.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IotSitesModel.java new file mode 100644 index 000000000000..395e7a66b747 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IotSitesModel.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.resourcemanager.security.fluent.models.IotSitesModelInner; +import java.util.Map; + +/** An immutable client-side representation of IotSitesModel. */ +public interface IotSitesModel { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the displayName property: Display name of the IoT site. + * + * @return the displayName value. + */ + String displayName(); + + /** + * Gets the tags property: Tags of the IoT site. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the inner com.azure.resourcemanager.security.fluent.models.IotSitesModelInner object. + * + * @return the inner object. + */ + IotSitesModelInner innerModel(); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IpAddress.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IpAddress.java new file mode 100644 index 000000000000..c784e2216018 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IpAddress.java @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** IP Address information. */ +@Immutable +public final class IpAddress { + @JsonIgnore private final ClientLogger logger = new ClientLogger(IpAddress.class); + + /* + * IPV4 address + */ + @JsonProperty(value = "v4Address", access = JsonProperty.Access.WRITE_ONLY) + private String v4Address; + + /* + * Detection time of the ip address. + */ + @JsonProperty(value = "detectionTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime detectionTime; + + /* + * Subnet Classless Inter-Domain Routing + */ + @JsonProperty(value = "subnetCidr", access = JsonProperty.Access.WRITE_ONLY) + private String subnetCidr; + + /* + * Fully qualified domain name + */ + @JsonProperty(value = "fqdn", access = JsonProperty.Access.WRITE_ONLY) + private String fqdn; + + /* + * FQDN last lookup time. + */ + @JsonProperty(value = "fqdnLastLookupTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime fqdnLastLookupTime; + + /** + * Get the v4Address property: IPV4 address. + * + * @return the v4Address value. + */ + public String v4Address() { + return this.v4Address; + } + + /** + * Get the detectionTime property: Detection time of the ip address. + * + * @return the detectionTime value. + */ + public OffsetDateTime detectionTime() { + return this.detectionTime; + } + + /** + * Get the subnetCidr property: Subnet Classless Inter-Domain Routing. + * + * @return the subnetCidr value. + */ + public String subnetCidr() { + return this.subnetCidr; + } + + /** + * Get the fqdn property: Fully qualified domain name. + * + * @return the fqdn value. + */ + public String fqdn() { + return this.fqdn; + } + + /** + * Get the fqdnLastLookupTime property: FQDN last lookup time. + * + * @return the fqdnLastLookupTime value. + */ + public OffsetDateTime fqdnLastLookupTime() { + return this.fqdnLastLookupTime; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/JitNetworkAccessPolicies.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/JitNetworkAccessPolicies.java new file mode 100644 index 000000000000..36ce49f915a7 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/JitNetworkAccessPolicies.java @@ -0,0 +1,270 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of JitNetworkAccessPolicies. */ +public interface JitNetworkAccessPolicies { + /** + * Policies for protecting resources using Just-in-Time access control. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + PagedIterable list(); + + /** + * Policies for protecting resources using Just-in-Time access control. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + PagedIterable list(Context context); + + /** + * Policies for protecting resources using Just-in-Time access control for the subscription, location. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + PagedIterable listByRegion(String ascLocation); + + /** + * Policies for protecting resources using Just-in-Time access control for the subscription, location. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + PagedIterable listByRegion(String ascLocation, Context context); + + /** + * Policies for protecting resources using Just-in-Time access control for the subscription, location. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Policies for protecting resources using Just-in-Time access control for the subscription, location. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Policies for protecting resources using Just-in-Time access control for the subscription, location. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + PagedIterable listByResourceGroupAndRegion(String resourceGroupName, String ascLocation); + + /** + * Policies for protecting resources using Just-in-Time access control for the subscription, location. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + PagedIterable listByResourceGroupAndRegion( + String resourceGroupName, String ascLocation, Context context); + + /** + * Policies for protecting resources using Just-in-Time access control for the subscription, location. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param jitNetworkAccessPolicyName Name of a Just-in-Time access configuration policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + JitNetworkAccessPolicy get(String resourceGroupName, String ascLocation, String jitNetworkAccessPolicyName); + + /** + * Policies for protecting resources using Just-in-Time access control for the subscription, location. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param jitNetworkAccessPolicyName Name of a Just-in-Time access configuration policy. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response getWithResponse( + String resourceGroupName, String ascLocation, String jitNetworkAccessPolicyName, Context context); + + /** + * Delete a Just-in-Time access control policy. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param jitNetworkAccessPolicyName Name of a Just-in-Time access configuration policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String ascLocation, String jitNetworkAccessPolicyName); + + /** + * Delete a Just-in-Time access control policy. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param jitNetworkAccessPolicyName Name of a Just-in-Time access configuration policy. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response deleteWithResponse( + String resourceGroupName, String ascLocation, String jitNetworkAccessPolicyName, Context context); + + /** + * Initiate a JIT access from a specific Just-in-Time policy configuration. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param jitNetworkAccessPolicyName Name of a Just-in-Time access configuration policy. + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + JitNetworkAccessRequest initiate( + String resourceGroupName, + String ascLocation, + String jitNetworkAccessPolicyName, + JitNetworkAccessPolicyInitiateRequest body); + + /** + * Initiate a JIT access from a specific Just-in-Time policy configuration. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param jitNetworkAccessPolicyName Name of a Just-in-Time access configuration policy. + * @param body The body parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response initiateWithResponse( + String resourceGroupName, + String ascLocation, + String jitNetworkAccessPolicyName, + JitNetworkAccessPolicyInitiateRequest body, + Context context); + + /** + * Policies for protecting resources using Just-in-Time access control for the subscription, location. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + JitNetworkAccessPolicy getById(String id); + + /** + * Policies for protecting resources using Just-in-Time access control for the subscription, location. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete a Just-in-Time access control policy. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Delete a Just-in-Time access control policy. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new JitNetworkAccessPolicy resource. + * + * @param name resource name. + * @return the first stage of the new JitNetworkAccessPolicy definition. + */ + JitNetworkAccessPolicy.DefinitionStages.Blank define(String name); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/JitNetworkAccessPoliciesList.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/JitNetworkAccessPoliciesList.java new file mode 100644 index 000000000000..6769a04c0ab8 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/JitNetworkAccessPoliciesList.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.models.JitNetworkAccessPolicyInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The JitNetworkAccessPoliciesList model. */ +@Fluent +public final class JitNetworkAccessPoliciesList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(JitNetworkAccessPoliciesList.class); + + /* + * The value property. + */ + @JsonProperty(value = "value") + private List value; + + /* + * The URI to fetch the next page. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: The value property. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The value property. + * + * @param value the value value to set. + * @return the JitNetworkAccessPoliciesList object itself. + */ + public JitNetworkAccessPoliciesList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The URI to fetch the next page. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/JitNetworkAccessPolicy.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/JitNetworkAccessPolicy.java new file mode 100644 index 000000000000..9c165a64bb43 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/JitNetworkAccessPolicy.java @@ -0,0 +1,241 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.JitNetworkAccessPolicyInner; +import com.azure.resourcemanager.security.fluent.models.JitNetworkAccessRequestInner; +import java.util.List; + +/** An immutable client-side representation of JitNetworkAccessPolicy. */ +public interface JitNetworkAccessPolicy { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the virtualMachines property: Configurations for Microsoft.Compute/virtualMachines resource type. + * + * @return the virtualMachines value. + */ + List virtualMachines(); + + /** + * Gets the requests property: The requests property. + * + * @return the requests value. + */ + List requests(); + + /** + * Gets the provisioningState property: Gets the provisioning state of the Just-in-Time policy. + * + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * Gets the kind property: Kind of the resource. + * + * @return the kind value. + */ + String kind(); + + /** + * Gets the location property: Location where the resource is stored. + * + * @return the location value. + */ + String location(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the inner com.azure.resourcemanager.security.fluent.models.JitNetworkAccessPolicyInner object. + * + * @return the inner object. + */ + JitNetworkAccessPolicyInner innerModel(); + + /** The entirety of the JitNetworkAccessPolicy definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithParentResource, + DefinitionStages.WithVirtualMachines, + DefinitionStages.WithCreate { + } + /** The JitNetworkAccessPolicy definition stages. */ + interface DefinitionStages { + /** The first stage of the JitNetworkAccessPolicy definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the JitNetworkAccessPolicy definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, ascLocation. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @return the next definition stage. + */ + WithVirtualMachines withExistingLocation(String resourceGroupName, String ascLocation); + } + /** The stage of the JitNetworkAccessPolicy definition allowing to specify virtualMachines. */ + interface WithVirtualMachines { + /** + * Specifies the virtualMachines property: Configurations for Microsoft.Compute/virtualMachines resource + * type.. + * + * @param virtualMachines Configurations for Microsoft.Compute/virtualMachines resource type. + * @return the next definition stage. + */ + WithCreate withVirtualMachines(List virtualMachines); + } + /** + * The stage of the JitNetworkAccessPolicy definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithRequests, DefinitionStages.WithKind { + /** + * Executes the create request. + * + * @return the created resource. + */ + JitNetworkAccessPolicy create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + JitNetworkAccessPolicy create(Context context); + } + /** The stage of the JitNetworkAccessPolicy definition allowing to specify requests. */ + interface WithRequests { + /** + * Specifies the requests property: The requests property.. + * + * @param requests The requests property. + * @return the next definition stage. + */ + WithCreate withRequests(List requests); + } + /** The stage of the JitNetworkAccessPolicy definition allowing to specify kind. */ + interface WithKind { + /** + * Specifies the kind property: Kind of the resource. + * + * @param kind Kind of the resource. + * @return the next definition stage. + */ + WithCreate withKind(String kind); + } + } + /** + * Begins update for the JitNetworkAccessPolicy resource. + * + * @return the stage of resource update. + */ + JitNetworkAccessPolicy.Update update(); + + /** The template for JitNetworkAccessPolicy update. */ + interface Update extends UpdateStages.WithVirtualMachines, UpdateStages.WithRequests, UpdateStages.WithKind { + /** + * Executes the update request. + * + * @return the updated resource. + */ + JitNetworkAccessPolicy apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + JitNetworkAccessPolicy apply(Context context); + } + /** The JitNetworkAccessPolicy update stages. */ + interface UpdateStages { + /** The stage of the JitNetworkAccessPolicy update allowing to specify virtualMachines. */ + interface WithVirtualMachines { + /** + * Specifies the virtualMachines property: Configurations for Microsoft.Compute/virtualMachines resource + * type.. + * + * @param virtualMachines Configurations for Microsoft.Compute/virtualMachines resource type. + * @return the next definition stage. + */ + Update withVirtualMachines(List virtualMachines); + } + /** The stage of the JitNetworkAccessPolicy update allowing to specify requests. */ + interface WithRequests { + /** + * Specifies the requests property: The requests property.. + * + * @param requests The requests property. + * @return the next definition stage. + */ + Update withRequests(List requests); + } + /** The stage of the JitNetworkAccessPolicy update allowing to specify kind. */ + interface WithKind { + /** + * Specifies the kind property: Kind of the resource. + * + * @param kind Kind of the resource. + * @return the next definition stage. + */ + Update withKind(String kind); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + JitNetworkAccessPolicy refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + JitNetworkAccessPolicy refresh(Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/JitNetworkAccessPolicyInitiatePort.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/JitNetworkAccessPolicyInitiatePort.java new file mode 100644 index 000000000000..2d56c2c2cc1f --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/JitNetworkAccessPolicyInitiatePort.java @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** The JitNetworkAccessPolicyInitiatePort model. */ +@Fluent +public final class JitNetworkAccessPolicyInitiatePort { + @JsonIgnore private final ClientLogger logger = new ClientLogger(JitNetworkAccessPolicyInitiatePort.class); + + /* + * The number property. + */ + @JsonProperty(value = "number", required = true) + private int number; + + /* + * Source of the allowed traffic. If omitted, the request will be for the + * source IP address of the initiate request. + */ + @JsonProperty(value = "allowedSourceAddressPrefix") + private String allowedSourceAddressPrefix; + + /* + * The time to close the request in UTC + */ + @JsonProperty(value = "endTimeUtc", required = true) + private OffsetDateTime endTimeUtc; + + /** + * Get the number property: The number property. + * + * @return the number value. + */ + public int number() { + return this.number; + } + + /** + * Set the number property: The number property. + * + * @param number the number value to set. + * @return the JitNetworkAccessPolicyInitiatePort object itself. + */ + public JitNetworkAccessPolicyInitiatePort withNumber(int number) { + this.number = number; + return this; + } + + /** + * Get the allowedSourceAddressPrefix property: Source of the allowed traffic. If omitted, the request will be for + * the source IP address of the initiate request. + * + * @return the allowedSourceAddressPrefix value. + */ + public String allowedSourceAddressPrefix() { + return this.allowedSourceAddressPrefix; + } + + /** + * Set the allowedSourceAddressPrefix property: Source of the allowed traffic. If omitted, the request will be for + * the source IP address of the initiate request. + * + * @param allowedSourceAddressPrefix the allowedSourceAddressPrefix value to set. + * @return the JitNetworkAccessPolicyInitiatePort object itself. + */ + public JitNetworkAccessPolicyInitiatePort withAllowedSourceAddressPrefix(String allowedSourceAddressPrefix) { + this.allowedSourceAddressPrefix = allowedSourceAddressPrefix; + return this; + } + + /** + * Get the endTimeUtc property: The time to close the request in UTC. + * + * @return the endTimeUtc value. + */ + public OffsetDateTime endTimeUtc() { + return this.endTimeUtc; + } + + /** + * Set the endTimeUtc property: The time to close the request in UTC. + * + * @param endTimeUtc the endTimeUtc value to set. + * @return the JitNetworkAccessPolicyInitiatePort object itself. + */ + public JitNetworkAccessPolicyInitiatePort withEndTimeUtc(OffsetDateTime endTimeUtc) { + this.endTimeUtc = endTimeUtc; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (endTimeUtc() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property endTimeUtc in model JitNetworkAccessPolicyInitiatePort")); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/JitNetworkAccessPolicyInitiateRequest.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/JitNetworkAccessPolicyInitiateRequest.java new file mode 100644 index 000000000000..1513625e5e7b --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/JitNetworkAccessPolicyInitiateRequest.java @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The JitNetworkAccessPolicyInitiateRequest model. */ +@Fluent +public final class JitNetworkAccessPolicyInitiateRequest { + @JsonIgnore private final ClientLogger logger = new ClientLogger(JitNetworkAccessPolicyInitiateRequest.class); + + /* + * A list of virtual machines & ports to open access for + */ + @JsonProperty(value = "virtualMachines", required = true) + private List virtualMachines; + + /* + * The justification for making the initiate request + */ + @JsonProperty(value = "justification") + private String justification; + + /** + * Get the virtualMachines property: A list of virtual machines & ports to open access for. + * + * @return the virtualMachines value. + */ + public List virtualMachines() { + return this.virtualMachines; + } + + /** + * Set the virtualMachines property: A list of virtual machines & ports to open access for. + * + * @param virtualMachines the virtualMachines value to set. + * @return the JitNetworkAccessPolicyInitiateRequest object itself. + */ + public JitNetworkAccessPolicyInitiateRequest withVirtualMachines( + List virtualMachines) { + this.virtualMachines = virtualMachines; + return this; + } + + /** + * Get the justification property: The justification for making the initiate request. + * + * @return the justification value. + */ + public String justification() { + return this.justification; + } + + /** + * Set the justification property: The justification for making the initiate request. + * + * @param justification the justification value to set. + * @return the JitNetworkAccessPolicyInitiateRequest object itself. + */ + public JitNetworkAccessPolicyInitiateRequest withJustification(String justification) { + this.justification = justification; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (virtualMachines() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property virtualMachines in model JitNetworkAccessPolicyInitiateRequest")); + } else { + virtualMachines().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/JitNetworkAccessPolicyInitiateVirtualMachine.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/JitNetworkAccessPolicyInitiateVirtualMachine.java new file mode 100644 index 000000000000..5c5a93bf2726 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/JitNetworkAccessPolicyInitiateVirtualMachine.java @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The JitNetworkAccessPolicyInitiateVirtualMachine model. */ +@Fluent +public final class JitNetworkAccessPolicyInitiateVirtualMachine { + @JsonIgnore + private final ClientLogger logger = new ClientLogger(JitNetworkAccessPolicyInitiateVirtualMachine.class); + + /* + * Resource ID of the virtual machine that is linked to this policy + */ + @JsonProperty(value = "id", required = true) + private String id; + + /* + * The ports to open for the resource with the `id` + */ + @JsonProperty(value = "ports", required = true) + private List ports; + + /** + * Get the id property: Resource ID of the virtual machine that is linked to this policy. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: Resource ID of the virtual machine that is linked to this policy. + * + * @param id the id value to set. + * @return the JitNetworkAccessPolicyInitiateVirtualMachine object itself. + */ + public JitNetworkAccessPolicyInitiateVirtualMachine withId(String id) { + this.id = id; + return this; + } + + /** + * Get the ports property: The ports to open for the resource with the `id`. + * + * @return the ports value. + */ + public List ports() { + return this.ports; + } + + /** + * Set the ports property: The ports to open for the resource with the `id`. + * + * @param ports the ports value to set. + * @return the JitNetworkAccessPolicyInitiateVirtualMachine object itself. + */ + public JitNetworkAccessPolicyInitiateVirtualMachine withPorts(List ports) { + this.ports = ports; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (id() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property id in model JitNetworkAccessPolicyInitiateVirtualMachine")); + } + if (ports() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property ports in model JitNetworkAccessPolicyInitiateVirtualMachine")); + } else { + ports().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/JitNetworkAccessPolicyVirtualMachine.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/JitNetworkAccessPolicyVirtualMachine.java new file mode 100644 index 000000000000..0568c2e48924 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/JitNetworkAccessPolicyVirtualMachine.java @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The JitNetworkAccessPolicyVirtualMachine model. */ +@Fluent +public final class JitNetworkAccessPolicyVirtualMachine { + @JsonIgnore private final ClientLogger logger = new ClientLogger(JitNetworkAccessPolicyVirtualMachine.class); + + /* + * Resource ID of the virtual machine that is linked to this policy + */ + @JsonProperty(value = "id", required = true) + private String id; + + /* + * Port configurations for the virtual machine + */ + @JsonProperty(value = "ports", required = true) + private List ports; + + /* + * Public IP address of the Azure Firewall that is linked to this policy, + * if applicable + */ + @JsonProperty(value = "publicIpAddress") + private String publicIpAddress; + + /** + * Get the id property: Resource ID of the virtual machine that is linked to this policy. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: Resource ID of the virtual machine that is linked to this policy. + * + * @param id the id value to set. + * @return the JitNetworkAccessPolicyVirtualMachine object itself. + */ + public JitNetworkAccessPolicyVirtualMachine withId(String id) { + this.id = id; + return this; + } + + /** + * Get the ports property: Port configurations for the virtual machine. + * + * @return the ports value. + */ + public List ports() { + return this.ports; + } + + /** + * Set the ports property: Port configurations for the virtual machine. + * + * @param ports the ports value to set. + * @return the JitNetworkAccessPolicyVirtualMachine object itself. + */ + public JitNetworkAccessPolicyVirtualMachine withPorts(List ports) { + this.ports = ports; + return this; + } + + /** + * Get the publicIpAddress property: Public IP address of the Azure Firewall that is linked to this policy, if + * applicable. + * + * @return the publicIpAddress value. + */ + public String publicIpAddress() { + return this.publicIpAddress; + } + + /** + * Set the publicIpAddress property: Public IP address of the Azure Firewall that is linked to this policy, if + * applicable. + * + * @param publicIpAddress the publicIpAddress value to set. + * @return the JitNetworkAccessPolicyVirtualMachine object itself. + */ + public JitNetworkAccessPolicyVirtualMachine withPublicIpAddress(String publicIpAddress) { + this.publicIpAddress = publicIpAddress; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (id() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property id in model JitNetworkAccessPolicyVirtualMachine")); + } + if (ports() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property ports in model JitNetworkAccessPolicyVirtualMachine")); + } else { + ports().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/JitNetworkAccessPortRule.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/JitNetworkAccessPortRule.java new file mode 100644 index 000000000000..37ef46d6e1e9 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/JitNetworkAccessPortRule.java @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The JitNetworkAccessPortRule model. */ +@Fluent +public final class JitNetworkAccessPortRule { + @JsonIgnore private final ClientLogger logger = new ClientLogger(JitNetworkAccessPortRule.class); + + /* + * The number property. + */ + @JsonProperty(value = "number", required = true) + private int number; + + /* + * The protocol property. + */ + @JsonProperty(value = "protocol", required = true) + private ProtocolValue protocol; + + /* + * Mutually exclusive with the "allowedSourceAddressPrefixes" parameter. + * Should be an IP address or CIDR, for example "192.168.0.3" or + * "192.168.0.0/16". + */ + @JsonProperty(value = "allowedSourceAddressPrefix") + private String allowedSourceAddressPrefix; + + /* + * Mutually exclusive with the "allowedSourceAddressPrefix" parameter. + */ + @JsonProperty(value = "allowedSourceAddressPrefixes") + private List allowedSourceAddressPrefixes; + + /* + * Maximum duration requests can be made for. In ISO 8601 duration format. + * Minimum 5 minutes, maximum 1 day + */ + @JsonProperty(value = "maxRequestAccessDuration", required = true) + private String maxRequestAccessDuration; + + /** + * Get the number property: The number property. + * + * @return the number value. + */ + public int number() { + return this.number; + } + + /** + * Set the number property: The number property. + * + * @param number the number value to set. + * @return the JitNetworkAccessPortRule object itself. + */ + public JitNetworkAccessPortRule withNumber(int number) { + this.number = number; + return this; + } + + /** + * Get the protocol property: The protocol property. + * + * @return the protocol value. + */ + public ProtocolValue protocol() { + return this.protocol; + } + + /** + * Set the protocol property: The protocol property. + * + * @param protocol the protocol value to set. + * @return the JitNetworkAccessPortRule object itself. + */ + public JitNetworkAccessPortRule withProtocol(ProtocolValue protocol) { + this.protocol = protocol; + return this; + } + + /** + * Get the allowedSourceAddressPrefix property: Mutually exclusive with the "allowedSourceAddressPrefixes" + * parameter. Should be an IP address or CIDR, for example "192.168.0.3" or "192.168.0.0/16". + * + * @return the allowedSourceAddressPrefix value. + */ + public String allowedSourceAddressPrefix() { + return this.allowedSourceAddressPrefix; + } + + /** + * Set the allowedSourceAddressPrefix property: Mutually exclusive with the "allowedSourceAddressPrefixes" + * parameter. Should be an IP address or CIDR, for example "192.168.0.3" or "192.168.0.0/16". + * + * @param allowedSourceAddressPrefix the allowedSourceAddressPrefix value to set. + * @return the JitNetworkAccessPortRule object itself. + */ + public JitNetworkAccessPortRule withAllowedSourceAddressPrefix(String allowedSourceAddressPrefix) { + this.allowedSourceAddressPrefix = allowedSourceAddressPrefix; + return this; + } + + /** + * Get the allowedSourceAddressPrefixes property: Mutually exclusive with the "allowedSourceAddressPrefix" + * parameter. + * + * @return the allowedSourceAddressPrefixes value. + */ + public List allowedSourceAddressPrefixes() { + return this.allowedSourceAddressPrefixes; + } + + /** + * Set the allowedSourceAddressPrefixes property: Mutually exclusive with the "allowedSourceAddressPrefix" + * parameter. + * + * @param allowedSourceAddressPrefixes the allowedSourceAddressPrefixes value to set. + * @return the JitNetworkAccessPortRule object itself. + */ + public JitNetworkAccessPortRule withAllowedSourceAddressPrefixes(List allowedSourceAddressPrefixes) { + this.allowedSourceAddressPrefixes = allowedSourceAddressPrefixes; + return this; + } + + /** + * Get the maxRequestAccessDuration property: Maximum duration requests can be made for. In ISO 8601 duration + * format. Minimum 5 minutes, maximum 1 day. + * + * @return the maxRequestAccessDuration value. + */ + public String maxRequestAccessDuration() { + return this.maxRequestAccessDuration; + } + + /** + * Set the maxRequestAccessDuration property: Maximum duration requests can be made for. In ISO 8601 duration + * format. Minimum 5 minutes, maximum 1 day. + * + * @param maxRequestAccessDuration the maxRequestAccessDuration value to set. + * @return the JitNetworkAccessPortRule object itself. + */ + public JitNetworkAccessPortRule withMaxRequestAccessDuration(String maxRequestAccessDuration) { + this.maxRequestAccessDuration = maxRequestAccessDuration; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (protocol() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property protocol in model JitNetworkAccessPortRule")); + } + if (maxRequestAccessDuration() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property maxRequestAccessDuration in model JitNetworkAccessPortRule")); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/JitNetworkAccessRequest.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/JitNetworkAccessRequest.java new file mode 100644 index 000000000000..21ec47f493ac --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/JitNetworkAccessRequest.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.resourcemanager.security.fluent.models.JitNetworkAccessRequestInner; +import java.time.OffsetDateTime; +import java.util.List; + +/** An immutable client-side representation of JitNetworkAccessRequest. */ +public interface JitNetworkAccessRequest { + /** + * Gets the virtualMachines property: The virtualMachines property. + * + * @return the virtualMachines value. + */ + List virtualMachines(); + + /** + * Gets the startTimeUtc property: The start time of the request in UTC. + * + * @return the startTimeUtc value. + */ + OffsetDateTime startTimeUtc(); + + /** + * Gets the requestor property: The identity of the person who made the request. + * + * @return the requestor value. + */ + String requestor(); + + /** + * Gets the justification property: The justification for making the initiate request. + * + * @return the justification value. + */ + String justification(); + + /** + * Gets the inner com.azure.resourcemanager.security.fluent.models.JitNetworkAccessRequestInner object. + * + * @return the inner object. + */ + JitNetworkAccessRequestInner innerModel(); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/JitNetworkAccessRequestPort.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/JitNetworkAccessRequestPort.java new file mode 100644 index 000000000000..9084c5849058 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/JitNetworkAccessRequestPort.java @@ -0,0 +1,235 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** The JitNetworkAccessRequestPort model. */ +@Fluent +public final class JitNetworkAccessRequestPort { + @JsonIgnore private final ClientLogger logger = new ClientLogger(JitNetworkAccessRequestPort.class); + + /* + * The number property. + */ + @JsonProperty(value = "number", required = true) + private int number; + + /* + * Mutually exclusive with the "allowedSourceAddressPrefixes" parameter. + * Should be an IP address or CIDR, for example "192.168.0.3" or + * "192.168.0.0/16". + */ + @JsonProperty(value = "allowedSourceAddressPrefix") + private String allowedSourceAddressPrefix; + + /* + * Mutually exclusive with the "allowedSourceAddressPrefix" parameter. + */ + @JsonProperty(value = "allowedSourceAddressPrefixes") + private List allowedSourceAddressPrefixes; + + /* + * The date & time at which the request ends in UTC + */ + @JsonProperty(value = "endTimeUtc", required = true) + private OffsetDateTime endTimeUtc; + + /* + * The status of the port + */ + @JsonProperty(value = "status", required = true) + private Status status; + + /* + * A description of why the `status` has its value + */ + @JsonProperty(value = "statusReason", required = true) + private StatusReason statusReason; + + /* + * The port which is mapped to this port's `number` in the Azure Firewall, + * if applicable + */ + @JsonProperty(value = "mappedPort") + private Integer mappedPort; + + /** + * Get the number property: The number property. + * + * @return the number value. + */ + public int number() { + return this.number; + } + + /** + * Set the number property: The number property. + * + * @param number the number value to set. + * @return the JitNetworkAccessRequestPort object itself. + */ + public JitNetworkAccessRequestPort withNumber(int number) { + this.number = number; + return this; + } + + /** + * Get the allowedSourceAddressPrefix property: Mutually exclusive with the "allowedSourceAddressPrefixes" + * parameter. Should be an IP address or CIDR, for example "192.168.0.3" or "192.168.0.0/16". + * + * @return the allowedSourceAddressPrefix value. + */ + public String allowedSourceAddressPrefix() { + return this.allowedSourceAddressPrefix; + } + + /** + * Set the allowedSourceAddressPrefix property: Mutually exclusive with the "allowedSourceAddressPrefixes" + * parameter. Should be an IP address or CIDR, for example "192.168.0.3" or "192.168.0.0/16". + * + * @param allowedSourceAddressPrefix the allowedSourceAddressPrefix value to set. + * @return the JitNetworkAccessRequestPort object itself. + */ + public JitNetworkAccessRequestPort withAllowedSourceAddressPrefix(String allowedSourceAddressPrefix) { + this.allowedSourceAddressPrefix = allowedSourceAddressPrefix; + return this; + } + + /** + * Get the allowedSourceAddressPrefixes property: Mutually exclusive with the "allowedSourceAddressPrefix" + * parameter. + * + * @return the allowedSourceAddressPrefixes value. + */ + public List allowedSourceAddressPrefixes() { + return this.allowedSourceAddressPrefixes; + } + + /** + * Set the allowedSourceAddressPrefixes property: Mutually exclusive with the "allowedSourceAddressPrefix" + * parameter. + * + * @param allowedSourceAddressPrefixes the allowedSourceAddressPrefixes value to set. + * @return the JitNetworkAccessRequestPort object itself. + */ + public JitNetworkAccessRequestPort withAllowedSourceAddressPrefixes(List allowedSourceAddressPrefixes) { + this.allowedSourceAddressPrefixes = allowedSourceAddressPrefixes; + return this; + } + + /** + * Get the endTimeUtc property: The date & time at which the request ends in UTC. + * + * @return the endTimeUtc value. + */ + public OffsetDateTime endTimeUtc() { + return this.endTimeUtc; + } + + /** + * Set the endTimeUtc property: The date & time at which the request ends in UTC. + * + * @param endTimeUtc the endTimeUtc value to set. + * @return the JitNetworkAccessRequestPort object itself. + */ + public JitNetworkAccessRequestPort withEndTimeUtc(OffsetDateTime endTimeUtc) { + this.endTimeUtc = endTimeUtc; + return this; + } + + /** + * Get the status property: The status of the port. + * + * @return the status value. + */ + public Status status() { + return this.status; + } + + /** + * Set the status property: The status of the port. + * + * @param status the status value to set. + * @return the JitNetworkAccessRequestPort object itself. + */ + public JitNetworkAccessRequestPort withStatus(Status status) { + this.status = status; + return this; + } + + /** + * Get the statusReason property: A description of why the `status` has its value. + * + * @return the statusReason value. + */ + public StatusReason statusReason() { + return this.statusReason; + } + + /** + * Set the statusReason property: A description of why the `status` has its value. + * + * @param statusReason the statusReason value to set. + * @return the JitNetworkAccessRequestPort object itself. + */ + public JitNetworkAccessRequestPort withStatusReason(StatusReason statusReason) { + this.statusReason = statusReason; + return this; + } + + /** + * Get the mappedPort property: The port which is mapped to this port's `number` in the Azure Firewall, if + * applicable. + * + * @return the mappedPort value. + */ + public Integer mappedPort() { + return this.mappedPort; + } + + /** + * Set the mappedPort property: The port which is mapped to this port's `number` in the Azure Firewall, if + * applicable. + * + * @param mappedPort the mappedPort value to set. + * @return the JitNetworkAccessRequestPort object itself. + */ + public JitNetworkAccessRequestPort withMappedPort(Integer mappedPort) { + this.mappedPort = mappedPort; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (endTimeUtc() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property endTimeUtc in model JitNetworkAccessRequestPort")); + } + if (status() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property status in model JitNetworkAccessRequestPort")); + } + if (statusReason() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property statusReason in model JitNetworkAccessRequestPort")); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/JitNetworkAccessRequestVirtualMachine.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/JitNetworkAccessRequestVirtualMachine.java new file mode 100644 index 000000000000..19ad9de63266 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/JitNetworkAccessRequestVirtualMachine.java @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The JitNetworkAccessRequestVirtualMachine model. */ +@Fluent +public final class JitNetworkAccessRequestVirtualMachine { + @JsonIgnore private final ClientLogger logger = new ClientLogger(JitNetworkAccessRequestVirtualMachine.class); + + /* + * Resource ID of the virtual machine that is linked to this policy + */ + @JsonProperty(value = "id", required = true) + private String id; + + /* + * The ports that were opened for the virtual machine + */ + @JsonProperty(value = "ports", required = true) + private List ports; + + /** + * Get the id property: Resource ID of the virtual machine that is linked to this policy. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: Resource ID of the virtual machine that is linked to this policy. + * + * @param id the id value to set. + * @return the JitNetworkAccessRequestVirtualMachine object itself. + */ + public JitNetworkAccessRequestVirtualMachine withId(String id) { + this.id = id; + return this; + } + + /** + * Get the ports property: The ports that were opened for the virtual machine. + * + * @return the ports value. + */ + public List ports() { + return this.ports; + } + + /** + * Set the ports property: The ports that were opened for the virtual machine. + * + * @param ports the ports value to set. + * @return the JitNetworkAccessRequestVirtualMachine object itself. + */ + public JitNetworkAccessRequestVirtualMachine withPorts(List ports) { + this.ports = ports; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (id() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property id in model JitNetworkAccessRequestVirtualMachine")); + } + if (ports() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property ports in model JitNetworkAccessRequestVirtualMachine")); + } else { + ports().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Kind.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Kind.java new file mode 100644 index 000000000000..6ffd19d58f03 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Kind.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Describes an Azure resource with kind. */ +@Fluent +public class Kind { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Kind.class); + + /* + * Kind of the resource + */ + @JsonProperty(value = "kind") + private String kind; + + /** + * Get the kind property: Kind of the resource. + * + * @return the kind value. + */ + public String kind() { + return this.kind; + } + + /** + * Set the kind property: Kind of the resource. + * + * @param kind the kind value to set. + * @return the Kind object itself. + */ + public Kind withKind(String kind) { + this.kind = kind; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/KindValue.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/KindValue.java new file mode 100644 index 000000000000..e8b8cda66147 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/KindValue.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for KindValue. */ +public final class KindValue extends ExpandableStringEnum { + /** Static value Bundles for KindValue. */ + public static final KindValue BUNDLES = fromString("Bundles"); + + /** + * Creates or finds a KindValue from its string representation. + * + * @param name a name to look for. + * @return the corresponding KindValue. + */ + @JsonCreator + public static KindValue fromString(String name) { + return fromString(name, KindValue.class); + } + + /** @return known KindValue values. */ + public static Collection values() { + return values(KindValue.class); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ListCustomAlertRule.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ListCustomAlertRule.java new file mode 100644 index 000000000000..353d3b52f0ac --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ListCustomAlertRule.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** A List custom alert rule. */ +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "ruleType", + defaultImpl = ListCustomAlertRule.class) +@JsonTypeName("ListCustomAlertRule") +@JsonSubTypes({ + @JsonSubTypes.Type(name = "AllowlistCustomAlertRule", value = AllowlistCustomAlertRule.class), + @JsonSubTypes.Type(name = "DenylistCustomAlertRule", value = DenylistCustomAlertRule.class) +}) +@Fluent +public class ListCustomAlertRule extends CustomAlertRule { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ListCustomAlertRule.class); + + /* + * The value type of the items in the list. + */ + @JsonProperty(value = "valueType", access = JsonProperty.Access.WRITE_ONLY) + private ValueType valueType; + + /** + * Get the valueType property: The value type of the items in the list. + * + * @return the valueType value. + */ + public ValueType valueType() { + return this.valueType; + } + + /** {@inheritDoc} */ + @Override + public ListCustomAlertRule withIsEnabled(boolean isEnabled) { + super.withIsEnabled(isEnabled); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/LocalUserNotAllowed.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/LocalUserNotAllowed.java new file mode 100644 index 000000000000..292e8b11d343 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/LocalUserNotAllowed.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.util.List; + +/** Login by a local user that isn't allowed. Allow list consists of login names to allow. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "ruleType") +@JsonTypeName("LocalUserNotAllowed") +@Fluent +public final class LocalUserNotAllowed extends AllowlistCustomAlertRule { + @JsonIgnore private final ClientLogger logger = new ClientLogger(LocalUserNotAllowed.class); + + /** {@inheritDoc} */ + @Override + public LocalUserNotAllowed withAllowlistValues(List allowlistValues) { + super.withAllowlistValues(allowlistValues); + return this; + } + + /** {@inheritDoc} */ + @Override + public LocalUserNotAllowed withIsEnabled(boolean isEnabled) { + super.withIsEnabled(isEnabled); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Location.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Location.java new file mode 100644 index 000000000000..2956622b96b5 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Location.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Describes an Azure resource with location. */ +@Immutable +public class Location { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Location.class); + + /* + * Location where the resource is stored + */ + @JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY) + private String location; + + /** + * Get the location property: Location where the resource is stored. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Locations.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Locations.java new file mode 100644 index 000000000000..87613b589654 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Locations.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of Locations. */ +public interface Locations { + /** + * The location of the responsible ASC of the specific subscription (home region). For each subscription there is + * only one responsible location. The location in the response should be used to read or write other resources in + * ASC according to their ID. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of locations where ASC saves your data. + */ + PagedIterable list(); + + /** + * The location of the responsible ASC of the specific subscription (home region). For each subscription there is + * only one responsible location. The location in the response should be used to read or write other resources in + * ASC according to their ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of locations where ASC saves your data. + */ + PagedIterable list(Context context); + + /** + * Details of a specific location. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the ASC location of the subscription is in the "name" field. + */ + AscLocation get(String ascLocation); + + /** + * Details of a specific location. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the ASC location of the subscription is in the "name" field. + */ + Response getWithResponse(String ascLocation, Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/LogAnalyticsIdentifier.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/LogAnalyticsIdentifier.java new file mode 100644 index 000000000000..3da8debb41f0 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/LogAnalyticsIdentifier.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** Represents a Log Analytics workspace scope identifier. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("LogAnalytics") +@Immutable +public final class LogAnalyticsIdentifier extends ResourceIdentifier { + @JsonIgnore private final ClientLogger logger = new ClientLogger(LogAnalyticsIdentifier.class); + + /* + * The LogAnalytics workspace id that stores this alert. + */ + @JsonProperty(value = "workspaceId", access = JsonProperty.Access.WRITE_ONLY) + private String workspaceId; + + /* + * The azure subscription id for the LogAnalytics workspace storing this + * alert. + */ + @JsonProperty(value = "workspaceSubscriptionId", access = JsonProperty.Access.WRITE_ONLY) + private String workspaceSubscriptionId; + + /* + * The azure resource group for the LogAnalytics workspace storing this + * alert + */ + @JsonProperty(value = "workspaceResourceGroup", access = JsonProperty.Access.WRITE_ONLY) + private String workspaceResourceGroup; + + /* + * (optional) The LogAnalytics agent id reporting the event that this alert + * is based on. + */ + @JsonProperty(value = "agentId", access = JsonProperty.Access.WRITE_ONLY) + private String agentId; + + /** + * Get the workspaceId property: The LogAnalytics workspace id that stores this alert. + * + * @return the workspaceId value. + */ + public String workspaceId() { + return this.workspaceId; + } + + /** + * Get the workspaceSubscriptionId property: The azure subscription id for the LogAnalytics workspace storing this + * alert. + * + * @return the workspaceSubscriptionId value. + */ + public String workspaceSubscriptionId() { + return this.workspaceSubscriptionId; + } + + /** + * Get the workspaceResourceGroup property: The azure resource group for the LogAnalytics workspace storing this + * alert. + * + * @return the workspaceResourceGroup value. + */ + public String workspaceResourceGroup() { + return this.workspaceResourceGroup; + } + + /** + * Get the agentId property: (optional) The LogAnalytics agent id reporting the event that this alert is based on. + * + * @return the agentId value. + */ + public String agentId() { + return this.agentId; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/MacAddress.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/MacAddress.java new file mode 100644 index 000000000000..037adcaea602 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/MacAddress.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** MAC Address information. */ +@Immutable +public final class MacAddress { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MacAddress.class); + + /* + * MAC address + */ + @JsonProperty(value = "address", access = JsonProperty.Access.WRITE_ONLY) + private String address; + + /* + * Detection time of the mac address. + */ + @JsonProperty(value = "detectionTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime detectionTime; + + /* + * Indicates whether this is the primary secondary MAC address of the + * device + */ + @JsonProperty(value = "significance", access = JsonProperty.Access.WRITE_ONLY) + private MacSignificance significance; + + /* + * Indicates whether the relation of the mac to the ip address is certain + * or a guess + */ + @JsonProperty(value = "relationToIpStatus", access = JsonProperty.Access.WRITE_ONLY) + private RelationToIpStatus relationToIpStatus; + + /** + * Get the address property: MAC address. + * + * @return the address value. + */ + public String address() { + return this.address; + } + + /** + * Get the detectionTime property: Detection time of the mac address. + * + * @return the detectionTime value. + */ + public OffsetDateTime detectionTime() { + return this.detectionTime; + } + + /** + * Get the significance property: Indicates whether this is the primary secondary MAC address of the device. + * + * @return the significance value. + */ + public MacSignificance significance() { + return this.significance; + } + + /** + * Get the relationToIpStatus property: Indicates whether the relation of the mac to the ip address is certain or a + * guess. + * + * @return the relationToIpStatus value. + */ + public RelationToIpStatus relationToIpStatus() { + return this.relationToIpStatus; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/MacSignificance.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/MacSignificance.java new file mode 100644 index 000000000000..9c3aebd6eb0a --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/MacSignificance.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for MacSignificance. */ +public final class MacSignificance extends ExpandableStringEnum { + /** Static value Primary for MacSignificance. */ + public static final MacSignificance PRIMARY = fromString("Primary"); + + /** Static value Secondary for MacSignificance. */ + public static final MacSignificance SECONDARY = fromString("Secondary"); + + /** + * Creates or finds a MacSignificance from its string representation. + * + * @param name a name to look for. + * @return the corresponding MacSignificance. + */ + @JsonCreator + public static MacSignificance fromString(String name) { + return fromString(name, MacSignificance.class); + } + + /** @return known MacSignificance values. */ + public static Collection values() { + return values(MacSignificance.class); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ManagementState.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ManagementState.java new file mode 100644 index 000000000000..eb5b3508b35e --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ManagementState.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ManagementState. */ +public final class ManagementState extends ExpandableStringEnum { + /** Static value Managed for ManagementState. */ + public static final ManagementState MANAGED = fromString("Managed"); + + /** Static value Unmanaged for ManagementState. */ + public static final ManagementState UNMANAGED = fromString("Unmanaged"); + + /** + * Creates or finds a ManagementState from its string representation. + * + * @param name a name to look for. + * @return the corresponding ManagementState. + */ + @JsonCreator + public static ManagementState fromString(String name) { + return fromString(name, ManagementState.class); + } + + /** @return known ManagementState values. */ + public static Collection values() { + return values(ManagementState.class); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/MqttC2DMessagesNotInAllowedRange.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/MqttC2DMessagesNotInAllowedRange.java new file mode 100644 index 000000000000..8f6d262d9356 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/MqttC2DMessagesNotInAllowedRange.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.time.Duration; + +/** Number of cloud to device messages (MQTT protocol) is not in allowed range. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "ruleType") +@JsonTypeName("MqttC2DMessagesNotInAllowedRange") +@Fluent +public final class MqttC2DMessagesNotInAllowedRange extends TimeWindowCustomAlertRule { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MqttC2DMessagesNotInAllowedRange.class); + + /** {@inheritDoc} */ + @Override + public MqttC2DMessagesNotInAllowedRange withTimeWindowSize(Duration timeWindowSize) { + super.withTimeWindowSize(timeWindowSize); + return this; + } + + /** {@inheritDoc} */ + @Override + public MqttC2DMessagesNotInAllowedRange withMinThreshold(int minThreshold) { + super.withMinThreshold(minThreshold); + return this; + } + + /** {@inheritDoc} */ + @Override + public MqttC2DMessagesNotInAllowedRange withMaxThreshold(int maxThreshold) { + super.withMaxThreshold(maxThreshold); + return this; + } + + /** {@inheritDoc} */ + @Override + public MqttC2DMessagesNotInAllowedRange withIsEnabled(boolean isEnabled) { + super.withIsEnabled(isEnabled); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/MqttC2DRejectedMessagesNotInAllowedRange.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/MqttC2DRejectedMessagesNotInAllowedRange.java new file mode 100644 index 000000000000..8d424bced9b4 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/MqttC2DRejectedMessagesNotInAllowedRange.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.time.Duration; + +/** Number of rejected cloud to device messages (MQTT protocol) is not in allowed range. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "ruleType") +@JsonTypeName("MqttC2DRejectedMessagesNotInAllowedRange") +@Fluent +public final class MqttC2DRejectedMessagesNotInAllowedRange extends TimeWindowCustomAlertRule { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MqttC2DRejectedMessagesNotInAllowedRange.class); + + /** {@inheritDoc} */ + @Override + public MqttC2DRejectedMessagesNotInAllowedRange withTimeWindowSize(Duration timeWindowSize) { + super.withTimeWindowSize(timeWindowSize); + return this; + } + + /** {@inheritDoc} */ + @Override + public MqttC2DRejectedMessagesNotInAllowedRange withMinThreshold(int minThreshold) { + super.withMinThreshold(minThreshold); + return this; + } + + /** {@inheritDoc} */ + @Override + public MqttC2DRejectedMessagesNotInAllowedRange withMaxThreshold(int maxThreshold) { + super.withMaxThreshold(maxThreshold); + return this; + } + + /** {@inheritDoc} */ + @Override + public MqttC2DRejectedMessagesNotInAllowedRange withIsEnabled(boolean isEnabled) { + super.withIsEnabled(isEnabled); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/MqttD2CMessagesNotInAllowedRange.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/MqttD2CMessagesNotInAllowedRange.java new file mode 100644 index 000000000000..c0be0f3bdc09 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/MqttD2CMessagesNotInAllowedRange.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.time.Duration; + +/** Number of device to cloud messages (MQTT protocol) is not in allowed range. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "ruleType") +@JsonTypeName("MqttD2CMessagesNotInAllowedRange") +@Fluent +public final class MqttD2CMessagesNotInAllowedRange extends TimeWindowCustomAlertRule { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MqttD2CMessagesNotInAllowedRange.class); + + /** {@inheritDoc} */ + @Override + public MqttD2CMessagesNotInAllowedRange withTimeWindowSize(Duration timeWindowSize) { + super.withTimeWindowSize(timeWindowSize); + return this; + } + + /** {@inheritDoc} */ + @Override + public MqttD2CMessagesNotInAllowedRange withMinThreshold(int minThreshold) { + super.withMinThreshold(minThreshold); + return this; + } + + /** {@inheritDoc} */ + @Override + public MqttD2CMessagesNotInAllowedRange withMaxThreshold(int maxThreshold) { + super.withMaxThreshold(maxThreshold); + return this; + } + + /** {@inheritDoc} */ + @Override + public MqttD2CMessagesNotInAllowedRange withIsEnabled(boolean isEnabled) { + super.withIsEnabled(isEnabled); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/NetworkInterface.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/NetworkInterface.java new file mode 100644 index 000000000000..6670a53f57fe --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/NetworkInterface.java @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Network interface. */ +@Fluent +public final class NetworkInterface { + @JsonIgnore private final ClientLogger logger = new ClientLogger(NetworkInterface.class); + + /* + * IP Address information + */ + @JsonProperty(value = "ipAddress") + private IpAddress ipAddress; + + /* + * MAC Address information + */ + @JsonProperty(value = "macAddress") + private MacAddress macAddress; + + /* + * List of device vlans. + */ + @JsonProperty(value = "vlans", access = JsonProperty.Access.WRITE_ONLY) + private List vlans; + + /** + * Get the ipAddress property: IP Address information. + * + * @return the ipAddress value. + */ + public IpAddress ipAddress() { + return this.ipAddress; + } + + /** + * Set the ipAddress property: IP Address information. + * + * @param ipAddress the ipAddress value to set. + * @return the NetworkInterface object itself. + */ + public NetworkInterface withIpAddress(IpAddress ipAddress) { + this.ipAddress = ipAddress; + return this; + } + + /** + * Get the macAddress property: MAC Address information. + * + * @return the macAddress value. + */ + public MacAddress macAddress() { + return this.macAddress; + } + + /** + * Set the macAddress property: MAC Address information. + * + * @param macAddress the macAddress value to set. + * @return the NetworkInterface object itself. + */ + public NetworkInterface withMacAddress(MacAddress macAddress) { + this.macAddress = macAddress; + return this; + } + + /** + * Get the vlans property: List of device vlans. + * + * @return the vlans value. + */ + public List vlans() { + return this.vlans; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (ipAddress() != null) { + ipAddress().validate(); + } + if (macAddress() != null) { + macAddress().validate(); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/OnPremiseIotSensor.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/OnPremiseIotSensor.java new file mode 100644 index 000000000000..235c298fe0ee --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/OnPremiseIotSensor.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.resourcemanager.security.fluent.models.OnPremiseIotSensorInner; + +/** An immutable client-side representation of OnPremiseIotSensor. */ +public interface OnPremiseIotSensor { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the properties property: On-premise IoT sensor properties. + * + * @return the properties value. + */ + Object properties(); + + /** + * Gets the inner com.azure.resourcemanager.security.fluent.models.OnPremiseIotSensorInner object. + * + * @return the inner object. + */ + OnPremiseIotSensorInner innerModel(); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/OnPremiseIotSensors.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/OnPremiseIotSensors.java new file mode 100644 index 000000000000..faa8fa3c2ee1 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/OnPremiseIotSensors.java @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.StreamResponse; +import com.azure.core.util.Context; +import java.io.InputStream; + +/** Resource collection API of OnPremiseIotSensors. */ +public interface OnPremiseIotSensors { + /** + * List on-premise IoT sensors. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of on-premise IoT sensors. + */ + OnPremiseIotSensorsList list(); + + /** + * List on-premise IoT sensors. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of on-premise IoT sensors. + */ + Response listWithResponse(Context context); + + /** + * Get on-premise IoT sensor. + * + * @param onPremiseIotSensorName Name of the on-premise IoT sensor. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return on-premise IoT sensor. + */ + OnPremiseIotSensor get(String onPremiseIotSensorName); + + /** + * Get on-premise IoT sensor. + * + * @param onPremiseIotSensorName Name of the on-premise IoT sensor. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return on-premise IoT sensor. + */ + Response getWithResponse(String onPremiseIotSensorName, Context context); + + /** + * Create or update on-premise IoT sensor. + * + * @param onPremiseIotSensorName Name of the on-premise IoT sensor. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return on-premise IoT sensor. + */ + OnPremiseIotSensor createOrUpdate(String onPremiseIotSensorName); + + /** + * Create or update on-premise IoT sensor. + * + * @param onPremiseIotSensorName Name of the on-premise IoT sensor. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return on-premise IoT sensor. + */ + Response createOrUpdateWithResponse(String onPremiseIotSensorName, Context context); + + /** + * Delete on-premise IoT sensor. + * + * @param onPremiseIotSensorName Name of the on-premise IoT sensor. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String onPremiseIotSensorName); + + /** + * Delete on-premise IoT sensor. + * + * @param onPremiseIotSensorName Name of the on-premise IoT sensor. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response deleteWithResponse(String onPremiseIotSensorName, Context context); + + /** + * Download sensor activation file. + * + * @param onPremiseIotSensorName Name of the on-premise IoT sensor. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + InputStream downloadActivation(String onPremiseIotSensorName); + + /** + * Download sensor activation file. + * + * @param onPremiseIotSensorName Name of the on-premise IoT sensor. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + StreamResponse downloadActivationWithResponse(String onPremiseIotSensorName, Context context); + + /** + * Download file for reset password of the sensor. + * + * @param onPremiseIotSensorName Name of the on-premise IoT sensor. + * @param body Input for reset password. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + InputStream downloadResetPassword(String onPremiseIotSensorName, ResetPasswordInput body); + + /** + * Download file for reset password of the sensor. + * + * @param onPremiseIotSensorName Name of the on-premise IoT sensor. + * @param body Input for reset password. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + StreamResponse downloadResetPasswordWithResponse( + String onPremiseIotSensorName, ResetPasswordInput body, Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/OnPremiseIotSensorsList.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/OnPremiseIotSensorsList.java new file mode 100644 index 000000000000..4df50b2a0521 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/OnPremiseIotSensorsList.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.resourcemanager.security.fluent.models.OnPremiseIotSensorsListInner; +import java.util.List; + +/** An immutable client-side representation of OnPremiseIotSensorsList. */ +public interface OnPremiseIotSensorsList { + /** + * Gets the value property: List data. + * + * @return the value value. + */ + List value(); + + /** + * Gets the inner com.azure.resourcemanager.security.fluent.models.OnPremiseIotSensorsListInner object. + * + * @return the inner object. + */ + OnPremiseIotSensorsListInner innerModel(); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/OnPremiseResourceDetails.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/OnPremiseResourceDetails.java new file mode 100644 index 000000000000..9ac762fa5a14 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/OnPremiseResourceDetails.java @@ -0,0 +1,163 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** Details of the On Premise resource that was assessed. */ +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "source", + defaultImpl = OnPremiseResourceDetails.class) +@JsonTypeName("OnPremise") +@JsonSubTypes({@JsonSubTypes.Type(name = "OnPremiseSql", value = OnPremiseSqlResourceDetails.class)}) +@Fluent +public class OnPremiseResourceDetails extends ResourceDetails { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OnPremiseResourceDetails.class); + + /* + * Azure resource Id of the workspace the machine is attached to + */ + @JsonProperty(value = "workspaceId", required = true) + private String workspaceId; + + /* + * The unique Id of the machine + */ + @JsonProperty(value = "vmuuid", required = true) + private String vmuuid; + + /* + * The oms agent Id installed on the machine + */ + @JsonProperty(value = "sourceComputerId", required = true) + private String sourceComputerId; + + /* + * The name of the machine + */ + @JsonProperty(value = "machineName", required = true) + private String machineName; + + /** + * Get the workspaceId property: Azure resource Id of the workspace the machine is attached to. + * + * @return the workspaceId value. + */ + public String workspaceId() { + return this.workspaceId; + } + + /** + * Set the workspaceId property: Azure resource Id of the workspace the machine is attached to. + * + * @param workspaceId the workspaceId value to set. + * @return the OnPremiseResourceDetails object itself. + */ + public OnPremiseResourceDetails withWorkspaceId(String workspaceId) { + this.workspaceId = workspaceId; + return this; + } + + /** + * Get the vmuuid property: The unique Id of the machine. + * + * @return the vmuuid value. + */ + public String vmuuid() { + return this.vmuuid; + } + + /** + * Set the vmuuid property: The unique Id of the machine. + * + * @param vmuuid the vmuuid value to set. + * @return the OnPremiseResourceDetails object itself. + */ + public OnPremiseResourceDetails withVmuuid(String vmuuid) { + this.vmuuid = vmuuid; + return this; + } + + /** + * Get the sourceComputerId property: The oms agent Id installed on the machine. + * + * @return the sourceComputerId value. + */ + public String sourceComputerId() { + return this.sourceComputerId; + } + + /** + * Set the sourceComputerId property: The oms agent Id installed on the machine. + * + * @param sourceComputerId the sourceComputerId value to set. + * @return the OnPremiseResourceDetails object itself. + */ + public OnPremiseResourceDetails withSourceComputerId(String sourceComputerId) { + this.sourceComputerId = sourceComputerId; + return this; + } + + /** + * Get the machineName property: The name of the machine. + * + * @return the machineName value. + */ + public String machineName() { + return this.machineName; + } + + /** + * Set the machineName property: The name of the machine. + * + * @param machineName the machineName value to set. + * @return the OnPremiseResourceDetails object itself. + */ + public OnPremiseResourceDetails withMachineName(String machineName) { + this.machineName = machineName; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (workspaceId() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property workspaceId in model OnPremiseResourceDetails")); + } + if (vmuuid() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property vmuuid in model OnPremiseResourceDetails")); + } + if (sourceComputerId() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property sourceComputerId in model OnPremiseResourceDetails")); + } + if (machineName() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property machineName in model OnPremiseResourceDetails")); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/OnPremiseSqlResourceDetails.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/OnPremiseSqlResourceDetails.java new file mode 100644 index 000000000000..b12d82dd4839 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/OnPremiseSqlResourceDetails.java @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** Details of the On Premise Sql resource that was assessed. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "source") +@JsonTypeName("OnPremiseSql") +@Fluent +public final class OnPremiseSqlResourceDetails extends OnPremiseResourceDetails { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OnPremiseSqlResourceDetails.class); + + /* + * The Sql server name installed on the machine + */ + @JsonProperty(value = "serverName", required = true) + private String serverName; + + /* + * The Sql database name installed on the machine + */ + @JsonProperty(value = "databaseName", required = true) + private String databaseName; + + /** + * Get the serverName property: The Sql server name installed on the machine. + * + * @return the serverName value. + */ + public String serverName() { + return this.serverName; + } + + /** + * Set the serverName property: The Sql server name installed on the machine. + * + * @param serverName the serverName value to set. + * @return the OnPremiseSqlResourceDetails object itself. + */ + public OnPremiseSqlResourceDetails withServerName(String serverName) { + this.serverName = serverName; + return this; + } + + /** + * Get the databaseName property: The Sql database name installed on the machine. + * + * @return the databaseName value. + */ + public String databaseName() { + return this.databaseName; + } + + /** + * Set the databaseName property: The Sql database name installed on the machine. + * + * @param databaseName the databaseName value to set. + * @return the OnPremiseSqlResourceDetails object itself. + */ + public OnPremiseSqlResourceDetails withDatabaseName(String databaseName) { + this.databaseName = databaseName; + return this; + } + + /** {@inheritDoc} */ + @Override + public OnPremiseSqlResourceDetails withWorkspaceId(String workspaceId) { + super.withWorkspaceId(workspaceId); + return this; + } + + /** {@inheritDoc} */ + @Override + public OnPremiseSqlResourceDetails withVmuuid(String vmuuid) { + super.withVmuuid(vmuuid); + return this; + } + + /** {@inheritDoc} */ + @Override + public OnPremiseSqlResourceDetails withSourceComputerId(String sourceComputerId) { + super.withSourceComputerId(sourceComputerId); + return this; + } + + /** {@inheritDoc} */ + @Override + public OnPremiseSqlResourceDetails withMachineName(String machineName) { + super.withMachineName(machineName); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (serverName() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property serverName in model OnPremiseSqlResourceDetails")); + } + if (databaseName() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property databaseName in model OnPremiseSqlResourceDetails")); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/OnboardingKind.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/OnboardingKind.java new file mode 100644 index 000000000000..c055259f0cf1 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/OnboardingKind.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for OnboardingKind. */ +public final class OnboardingKind extends ExpandableStringEnum { + /** Static value Default for OnboardingKind. */ + public static final OnboardingKind DEFAULT = fromString("Default"); + + /** Static value MigratedToAzure for OnboardingKind. */ + public static final OnboardingKind MIGRATED_TO_AZURE = fromString("MigratedToAzure"); + + /** Static value Evaluation for OnboardingKind. */ + public static final OnboardingKind EVALUATION = fromString("Evaluation"); + + /** Static value Purchased for OnboardingKind. */ + public static final OnboardingKind PURCHASED = fromString("Purchased"); + + /** + * Creates or finds a OnboardingKind from its string representation. + * + * @param name a name to look for. + * @return the corresponding OnboardingKind. + */ + @JsonCreator + public static OnboardingKind fromString(String name) { + return fromString(name, OnboardingKind.class); + } + + /** @return known OnboardingKind values. */ + public static Collection values() { + return values(OnboardingKind.class); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Operation.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Operation.java new file mode 100644 index 000000000000..1b42f07bf3e5 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Operation.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.resourcemanager.security.fluent.models.OperationInner; + +/** An immutable client-side representation of Operation. */ +public interface Operation { + /** + * Gets the name property: Name of the operation. + * + * @return the name value. + */ + String name(); + + /** + * Gets the origin property: Where the operation is originated. + * + * @return the origin value. + */ + String origin(); + + /** + * Gets the display property: Security operation display. + * + * @return the display value. + */ + OperationDisplay display(); + + /** + * Gets the inner com.azure.resourcemanager.security.fluent.models.OperationInner object. + * + * @return the inner object. + */ + OperationInner innerModel(); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/OperationDisplay.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/OperationDisplay.java new file mode 100644 index 000000000000..aa32b6bdcdb6 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/OperationDisplay.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Security operation display. */ +@Immutable +public final class OperationDisplay { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationDisplay.class); + + /* + * The resource provider for the operation. + */ + @JsonProperty(value = "provider", access = JsonProperty.Access.WRITE_ONLY) + private String provider; + + /* + * The display name of the resource the operation applies to. + */ + @JsonProperty(value = "resource", access = JsonProperty.Access.WRITE_ONLY) + private String resource; + + /* + * The display name of the security operation. + */ + @JsonProperty(value = "operation", access = JsonProperty.Access.WRITE_ONLY) + private String operation; + + /* + * The description of the operation. + */ + @JsonProperty(value = "description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /** + * Get the provider property: The resource provider for the operation. + * + * @return the provider value. + */ + public String provider() { + return this.provider; + } + + /** + * Get the resource property: The display name of the resource the operation applies to. + * + * @return the resource value. + */ + public String resource() { + return this.resource; + } + + /** + * Get the operation property: The display name of the security operation. + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Get the description property: The description of the operation. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/OperationList.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/OperationList.java new file mode 100644 index 000000000000..27c50de0382d --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/OperationList.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.models.OperationInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of possible operations for Microsoft.Security resource provider. */ +@Fluent +public final class OperationList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationList.class); + + /* + * List of Security operations + */ + @JsonProperty(value = "value") + private List value; + + /* + * The URI to fetch the next page. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: List of Security operations. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: List of Security operations. + * + * @param value the value value to set. + * @return the OperationList object itself. + */ + public OperationList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The URI to fetch the next page. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Operations.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Operations.java new file mode 100644 index 000000000000..56b27049d7da --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Operations.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of Operations. */ +public interface Operations { + /** + * Exposes all available operations for discovery purposes. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of possible operations for Microsoft. + */ + PagedIterable list(); + + /** + * Exposes all available operations for discovery purposes. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of possible operations for Microsoft. + */ + PagedIterable list(Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Operator.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Operator.java new file mode 100644 index 000000000000..47b540a73c0d --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Operator.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for Operator. */ +public final class Operator extends ExpandableStringEnum { + /** Static value Equals for Operator. */ + public static final Operator EQUALS = fromString("Equals"); + + /** Static value GreaterThan for Operator. */ + public static final Operator GREATER_THAN = fromString("GreaterThan"); + + /** Static value GreaterThanOrEqualTo for Operator. */ + public static final Operator GREATER_THAN_OR_EQUAL_TO = fromString("GreaterThanOrEqualTo"); + + /** Static value LesserThan for Operator. */ + public static final Operator LESSER_THAN = fromString("LesserThan"); + + /** Static value LesserThanOrEqualTo for Operator. */ + public static final Operator LESSER_THAN_OR_EQUAL_TO = fromString("LesserThanOrEqualTo"); + + /** Static value NotEquals for Operator. */ + public static final Operator NOT_EQUALS = fromString("NotEquals"); + + /** Static value Contains for Operator. */ + public static final Operator CONTAINS = fromString("Contains"); + + /** Static value StartsWith for Operator. */ + public static final Operator STARTS_WITH = fromString("StartsWith"); + + /** Static value EndsWith for Operator. */ + public static final Operator ENDS_WITH = fromString("EndsWith"); + + /** + * Creates or finds a Operator from its string representation. + * + * @param name a name to look for. + * @return the corresponding Operator. + */ + @JsonCreator + public static Operator fromString(String name) { + return fromString(name, Operator.class); + } + + /** @return known Operator values. */ + public static Collection values() { + return values(Operator.class); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/PackageDownloadInfo.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/PackageDownloadInfo.java new file mode 100644 index 000000000000..ea84ae157a64 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/PackageDownloadInfo.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Information on a specific package download. */ +@Immutable +public class PackageDownloadInfo { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PackageDownloadInfo.class); + + /* + * Version number + */ + @JsonProperty(value = "version", access = JsonProperty.Access.WRITE_ONLY) + private String version; + + /* + * Download link + */ + @JsonProperty(value = "link", access = JsonProperty.Access.WRITE_ONLY) + private String link; + + /* + * Kind of the version + */ + @JsonProperty(value = "versionKind", access = JsonProperty.Access.WRITE_ONLY) + private VersionKind versionKind; + + /** + * Get the version property: Version number. + * + * @return the version value. + */ + public String version() { + return this.version; + } + + /** + * Get the link property: Download link. + * + * @return the link value. + */ + public String link() { + return this.link; + } + + /** + * Get the versionKind property: Kind of the version. + * + * @return the versionKind value. + */ + public VersionKind versionKind() { + return this.versionKind; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/PackageDownloads.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/PackageDownloads.java new file mode 100644 index 000000000000..f74d25932072 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/PackageDownloads.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.resourcemanager.security.fluent.models.PackageDownloadsInner; +import java.util.List; + +/** An immutable client-side representation of PackageDownloads. */ +public interface PackageDownloads { + /** + * Gets the sensor property: Contains all Sensor binary downloads. + * + * @return the sensor value. + */ + PackageDownloadsSensor sensor(); + + /** + * Gets the centralManager property: All downloads for Central Manager. + * + * @return the centralManager value. + */ + PackageDownloadsCentralManager centralManager(); + + /** + * Gets the threatIntelligence property: All downloads for threat intelligence. + * + * @return the threatIntelligence value. + */ + List threatIntelligence(); + + /** + * Gets the snmp property: SNMP Server file. + * + * @return the snmp value. + */ + List snmp(); + + /** + * Gets the wmiTool property: Used for local configuration export. + * + * @return the wmiTool value. + */ + List wmiTool(); + + /** + * Gets the authorizedDevicesImportTemplate property: Authorized devices import template. + * + * @return the authorizedDevicesImportTemplate value. + */ + List authorizedDevicesImportTemplate(); + + /** + * Gets the deviceInformationUpdateImportTemplate property: Authorized devices import template. + * + * @return the deviceInformationUpdateImportTemplate value. + */ + List deviceInformationUpdateImportTemplate(); + + /** + * Gets the inner com.azure.resourcemanager.security.fluent.models.PackageDownloadsInner object. + * + * @return the inner object. + */ + PackageDownloadsInner innerModel(); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/PackageDownloadsCentralManager.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/PackageDownloadsCentralManager.java new file mode 100644 index 000000000000..0a86e9478fec --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/PackageDownloadsCentralManager.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** All downloads for Central Manager. */ +@Immutable +public final class PackageDownloadsCentralManager { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PackageDownloadsCentralManager.class); + + /* + * Contains full package downloads + */ + @JsonProperty(value = "full", access = JsonProperty.Access.WRITE_ONLY) + private PackageDownloadsCentralManagerFull full; + + /* + * Central Manager upgrade package downloads (on existing installations) + */ + @JsonProperty(value = "upgrade", access = JsonProperty.Access.WRITE_ONLY) + private List upgrade; + + /** + * Get the full property: Contains full package downloads. + * + * @return the full value. + */ + public PackageDownloadsCentralManagerFull full() { + return this.full; + } + + /** + * Get the upgrade property: Central Manager upgrade package downloads (on existing installations). + * + * @return the upgrade value. + */ + public List upgrade() { + return this.upgrade; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (full() != null) { + full().validate(); + } + if (upgrade() != null) { + upgrade().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/PackageDownloadsCentralManagerFull.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/PackageDownloadsCentralManagerFull.java new file mode 100644 index 000000000000..523de3fdd59d --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/PackageDownloadsCentralManagerFull.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Contains full package downloads. */ +@Immutable +public final class PackageDownloadsCentralManagerFull { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PackageDownloadsCentralManagerFull.class); + + /* + * Contains all ISO full versions of the Central Manager + */ + @JsonProperty(value = "iso", access = JsonProperty.Access.WRITE_ONLY) + private List iso; + + /* + * Contains all OVF (virtual machine) full versions of the Central Manager + */ + @JsonProperty(value = "ovf", access = JsonProperty.Access.WRITE_ONLY) + private PackageDownloadsCentralManagerFullOvf ovf; + + /** + * Get the iso property: Contains all ISO full versions of the Central Manager. + * + * @return the iso value. + */ + public List iso() { + return this.iso; + } + + /** + * Get the ovf property: Contains all OVF (virtual machine) full versions of the Central Manager. + * + * @return the ovf value. + */ + public PackageDownloadsCentralManagerFullOvf ovf() { + return this.ovf; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (iso() != null) { + iso().forEach(e -> e.validate()); + } + if (ovf() != null) { + ovf().validate(); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/PackageDownloadsCentralManagerFullOvf.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/PackageDownloadsCentralManagerFullOvf.java new file mode 100644 index 000000000000..662451d2b386 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/PackageDownloadsCentralManagerFullOvf.java @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Contains all OVF (virtual machine) full versions of the Central Manager. */ +@Immutable +public final class PackageDownloadsCentralManagerFullOvf { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PackageDownloadsCentralManagerFullOvf.class); + + /* + * The Enterprise package type + */ + @JsonProperty(value = "enterprise", access = JsonProperty.Access.WRITE_ONLY) + private List enterprise; + + /* + * The EnterpriseHighAvailability package type + */ + @JsonProperty(value = "enterpriseHighAvailability", access = JsonProperty.Access.WRITE_ONLY) + private List enterpriseHighAvailability; + + /* + * The Medium package type + */ + @JsonProperty(value = "medium", access = JsonProperty.Access.WRITE_ONLY) + private List medium; + + /* + * The MediumHighAvailability package type + */ + @JsonProperty(value = "mediumHighAvailability", access = JsonProperty.Access.WRITE_ONLY) + private List mediumHighAvailability; + + /** + * Get the enterprise property: The Enterprise package type. + * + * @return the enterprise value. + */ + public List enterprise() { + return this.enterprise; + } + + /** + * Get the enterpriseHighAvailability property: The EnterpriseHighAvailability package type. + * + * @return the enterpriseHighAvailability value. + */ + public List enterpriseHighAvailability() { + return this.enterpriseHighAvailability; + } + + /** + * Get the medium property: The Medium package type. + * + * @return the medium value. + */ + public List medium() { + return this.medium; + } + + /** + * Get the mediumHighAvailability property: The MediumHighAvailability package type. + * + * @return the mediumHighAvailability value. + */ + public List mediumHighAvailability() { + return this.mediumHighAvailability; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (enterprise() != null) { + enterprise().forEach(e -> e.validate()); + } + if (enterpriseHighAvailability() != null) { + enterpriseHighAvailability().forEach(e -> e.validate()); + } + if (medium() != null) { + medium().forEach(e -> e.validate()); + } + if (mediumHighAvailability() != null) { + mediumHighAvailability().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/PackageDownloadsSensor.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/PackageDownloadsSensor.java new file mode 100644 index 000000000000..4e02e43b72a0 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/PackageDownloadsSensor.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Contains all Sensor binary downloads. */ +@Fluent +public final class PackageDownloadsSensor { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PackageDownloadsSensor.class); + + /* + * Contains full package downloads + */ + @JsonProperty(value = "full", access = JsonProperty.Access.WRITE_ONLY) + private PackageDownloadsSensorFull full; + + /* + * Sensor upgrade package downloads (on existing installations) + */ + @JsonProperty(value = "upgrade") + private List upgrade; + + /** + * Get the full property: Contains full package downloads. + * + * @return the full value. + */ + public PackageDownloadsSensorFull full() { + return this.full; + } + + /** + * Get the upgrade property: Sensor upgrade package downloads (on existing installations). + * + * @return the upgrade value. + */ + public List upgrade() { + return this.upgrade; + } + + /** + * Set the upgrade property: Sensor upgrade package downloads (on existing installations). + * + * @param upgrade the upgrade value to set. + * @return the PackageDownloadsSensor object itself. + */ + public PackageDownloadsSensor withUpgrade(List upgrade) { + this.upgrade = upgrade; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (full() != null) { + full().validate(); + } + if (upgrade() != null) { + upgrade().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/PackageDownloadsSensorFull.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/PackageDownloadsSensorFull.java new file mode 100644 index 000000000000..3860b435ea80 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/PackageDownloadsSensorFull.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Contains full package downloads. */ +@Fluent +public final class PackageDownloadsSensorFull { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PackageDownloadsSensorFull.class); + + /* + * Contains all ISO full versions for the sensor + */ + @JsonProperty(value = "iso", access = JsonProperty.Access.WRITE_ONLY) + private List iso; + + /* + * Contains all OVF (virtual machine) full versions for the sensor + */ + @JsonProperty(value = "ovf") + private PackageDownloadsSensorFullOvf ovf; + + /** + * Get the iso property: Contains all ISO full versions for the sensor. + * + * @return the iso value. + */ + public List iso() { + return this.iso; + } + + /** + * Get the ovf property: Contains all OVF (virtual machine) full versions for the sensor. + * + * @return the ovf value. + */ + public PackageDownloadsSensorFullOvf ovf() { + return this.ovf; + } + + /** + * Set the ovf property: Contains all OVF (virtual machine) full versions for the sensor. + * + * @param ovf the ovf value to set. + * @return the PackageDownloadsSensorFull object itself. + */ + public PackageDownloadsSensorFull withOvf(PackageDownloadsSensorFullOvf ovf) { + this.ovf = ovf; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (iso() != null) { + iso().forEach(e -> e.validate()); + } + if (ovf() != null) { + ovf().validate(); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/PackageDownloadsSensorFullOvf.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/PackageDownloadsSensorFullOvf.java new file mode 100644 index 000000000000..a002194a8de9 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/PackageDownloadsSensorFullOvf.java @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Contains all OVF (virtual machine) full versions for the sensor. */ +@Immutable +public final class PackageDownloadsSensorFullOvf { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PackageDownloadsSensorFullOvf.class); + + /* + * Enterprise package type + */ + @JsonProperty(value = "enterprise", access = JsonProperty.Access.WRITE_ONLY) + private List enterprise; + + /* + * Medium package type + */ + @JsonProperty(value = "medium", access = JsonProperty.Access.WRITE_ONLY) + private List medium; + + /* + * Line package type + */ + @JsonProperty(value = "line", access = JsonProperty.Access.WRITE_ONLY) + private List line; + + /** + * Get the enterprise property: Enterprise package type. + * + * @return the enterprise value. + */ + public List enterprise() { + return this.enterprise; + } + + /** + * Get the medium property: Medium package type. + * + * @return the medium value. + */ + public List medium() { + return this.medium; + } + + /** + * Get the line property: Line package type. + * + * @return the line value. + */ + public List line() { + return this.line; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (enterprise() != null) { + enterprise().forEach(e -> e.validate()); + } + if (medium() != null) { + medium().forEach(e -> e.validate()); + } + if (line() != null) { + line().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/PathRecommendation.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/PathRecommendation.java new file mode 100644 index 000000000000..95cf1ca2d60c --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/PathRecommendation.java @@ -0,0 +1,265 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Represents a path that is recommended to be allowed and its properties. */ +@Fluent +public final class PathRecommendation { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PathRecommendation.class); + + /* + * The full path of the file, or an identifier of the application + */ + @JsonProperty(value = "path") + private String path; + + /* + * The recommendation action of the machine or rule + */ + @JsonProperty(value = "action") + private RecommendationAction action; + + /* + * The type of IoT Security recommendation. + */ + @JsonProperty(value = "type") + private RecommendationType type; + + /* + * Represents the publisher information of a process/rule + */ + @JsonProperty(value = "publisherInfo") + private PublisherInfo publisherInfo; + + /* + * Whether the application is commonly run on the machine + */ + @JsonProperty(value = "common") + private Boolean common; + + /* + * The userSids property. + */ + @JsonProperty(value = "userSids") + private List userSids; + + /* + * The usernames property. + */ + @JsonProperty(value = "usernames") + private List usernames; + + /* + * The type of the file (for Linux files - Executable is used) + */ + @JsonProperty(value = "fileType") + private FileType fileType; + + /* + * The configuration status of the machines group or machine or rule + */ + @JsonProperty(value = "configurationStatus") + private ConfigurationStatus configurationStatus; + + /** + * Get the path property: The full path of the file, or an identifier of the application. + * + * @return the path value. + */ + public String path() { + return this.path; + } + + /** + * Set the path property: The full path of the file, or an identifier of the application. + * + * @param path the path value to set. + * @return the PathRecommendation object itself. + */ + public PathRecommendation withPath(String path) { + this.path = path; + return this; + } + + /** + * Get the action property: The recommendation action of the machine or rule. + * + * @return the action value. + */ + public RecommendationAction action() { + return this.action; + } + + /** + * Set the action property: The recommendation action of the machine or rule. + * + * @param action the action value to set. + * @return the PathRecommendation object itself. + */ + public PathRecommendation withAction(RecommendationAction action) { + this.action = action; + return this; + } + + /** + * Get the type property: The type of IoT Security recommendation. + * + * @return the type value. + */ + public RecommendationType type() { + return this.type; + } + + /** + * Set the type property: The type of IoT Security recommendation. + * + * @param type the type value to set. + * @return the PathRecommendation object itself. + */ + public PathRecommendation withType(RecommendationType type) { + this.type = type; + return this; + } + + /** + * Get the publisherInfo property: Represents the publisher information of a process/rule. + * + * @return the publisherInfo value. + */ + public PublisherInfo publisherInfo() { + return this.publisherInfo; + } + + /** + * Set the publisherInfo property: Represents the publisher information of a process/rule. + * + * @param publisherInfo the publisherInfo value to set. + * @return the PathRecommendation object itself. + */ + public PathRecommendation withPublisherInfo(PublisherInfo publisherInfo) { + this.publisherInfo = publisherInfo; + return this; + } + + /** + * Get the common property: Whether the application is commonly run on the machine. + * + * @return the common value. + */ + public Boolean common() { + return this.common; + } + + /** + * Set the common property: Whether the application is commonly run on the machine. + * + * @param common the common value to set. + * @return the PathRecommendation object itself. + */ + public PathRecommendation withCommon(Boolean common) { + this.common = common; + return this; + } + + /** + * Get the userSids property: The userSids property. + * + * @return the userSids value. + */ + public List userSids() { + return this.userSids; + } + + /** + * Set the userSids property: The userSids property. + * + * @param userSids the userSids value to set. + * @return the PathRecommendation object itself. + */ + public PathRecommendation withUserSids(List userSids) { + this.userSids = userSids; + return this; + } + + /** + * Get the usernames property: The usernames property. + * + * @return the usernames value. + */ + public List usernames() { + return this.usernames; + } + + /** + * Set the usernames property: The usernames property. + * + * @param usernames the usernames value to set. + * @return the PathRecommendation object itself. + */ + public PathRecommendation withUsernames(List usernames) { + this.usernames = usernames; + return this; + } + + /** + * Get the fileType property: The type of the file (for Linux files - Executable is used). + * + * @return the fileType value. + */ + public FileType fileType() { + return this.fileType; + } + + /** + * Set the fileType property: The type of the file (for Linux files - Executable is used). + * + * @param fileType the fileType value to set. + * @return the PathRecommendation object itself. + */ + public PathRecommendation withFileType(FileType fileType) { + this.fileType = fileType; + return this; + } + + /** + * Get the configurationStatus property: The configuration status of the machines group or machine or rule. + * + * @return the configurationStatus value. + */ + public ConfigurationStatus configurationStatus() { + return this.configurationStatus; + } + + /** + * Set the configurationStatus property: The configuration status of the machines group or machine or rule. + * + * @param configurationStatus the configurationStatus value to set. + * @return the PathRecommendation object itself. + */ + public PathRecommendation withConfigurationStatus(ConfigurationStatus configurationStatus) { + this.configurationStatus = configurationStatus; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (publisherInfo() != null) { + publisherInfo().validate(); + } + if (usernames() != null) { + usernames().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/PermissionProperty.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/PermissionProperty.java new file mode 100644 index 000000000000..52db38cf1785 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/PermissionProperty.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for PermissionProperty. */ +public final class PermissionProperty extends ExpandableStringEnum { + /** Static value AWS::AWSSecurityHubReadOnlyAccess for PermissionProperty. */ + public static final PermissionProperty AWS_AWSSECURITY_HUB_READ_ONLY_ACCESS = + fromString("AWS::AWSSecurityHubReadOnlyAccess"); + + /** Static value AWS::SecurityAudit for PermissionProperty. */ + public static final PermissionProperty AWS_SECURITY_AUDIT = fromString("AWS::SecurityAudit"); + + /** Static value AWS::AmazonSSMAutomationRole for PermissionProperty. */ + public static final PermissionProperty AWS_AMAZON_SSMAUTOMATION_ROLE = fromString("AWS::AmazonSSMAutomationRole"); + + /** Static value GCP::Security Center Admin Viewer for PermissionProperty. */ + public static final PermissionProperty GCP_SECURITY_CENTER_ADMIN_VIEWER = + fromString("GCP::Security Center Admin Viewer"); + + /** + * Creates or finds a PermissionProperty from its string representation. + * + * @param name a name to look for. + * @return the corresponding PermissionProperty. + */ + @JsonCreator + public static PermissionProperty fromString(String name) { + return fromString(name, PermissionProperty.class); + } + + /** @return known PermissionProperty values. */ + public static Collection values() { + return values(PermissionProperty.class); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Pricing.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Pricing.java new file mode 100644 index 000000000000..780d5b59a401 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Pricing.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.resourcemanager.security.fluent.models.PricingInner; +import java.time.Duration; + +/** An immutable client-side representation of Pricing. */ +public interface Pricing { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the pricingTier property: The pricing tier value. Azure Security Center is provided in two pricing tiers: + * free and standard, with the standard tier available with a trial period. The standard tier offers advanced + * security capabilities, while the free tier offers basic security features. + * + * @return the pricingTier value. + */ + PricingTier pricingTier(); + + /** + * Gets the freeTrialRemainingTime property: The duration left for the subscriptions free trial period - in ISO 8601 + * format (e.g. P3Y6M4DT12H30M5S). + * + * @return the freeTrialRemainingTime value. + */ + Duration freeTrialRemainingTime(); + + /** + * Gets the inner com.azure.resourcemanager.security.fluent.models.PricingInner object. + * + * @return the inner object. + */ + PricingInner innerModel(); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/PricingList.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/PricingList.java new file mode 100644 index 000000000000..70264fe70433 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/PricingList.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.resourcemanager.security.fluent.models.PricingListInner; +import java.util.List; + +/** An immutable client-side representation of PricingList. */ +public interface PricingList { + /** + * Gets the value property: List of pricing configurations. + * + * @return the value value. + */ + List value(); + + /** + * Gets the inner com.azure.resourcemanager.security.fluent.models.PricingListInner object. + * + * @return the inner object. + */ + PricingListInner innerModel(); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/PricingTier.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/PricingTier.java new file mode 100644 index 000000000000..b571897c5206 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/PricingTier.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for PricingTier. */ +public final class PricingTier extends ExpandableStringEnum { + /** Static value Free for PricingTier. */ + public static final PricingTier FREE = fromString("Free"); + + /** Static value Standard for PricingTier. */ + public static final PricingTier STANDARD = fromString("Standard"); + + /** + * Creates or finds a PricingTier from its string representation. + * + * @param name a name to look for. + * @return the corresponding PricingTier. + */ + @JsonCreator + public static PricingTier fromString(String name) { + return fromString(name, PricingTier.class); + } + + /** @return known PricingTier values. */ + public static Collection values() { + return values(PricingTier.class); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Pricings.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Pricings.java new file mode 100644 index 000000000000..01545110d4f5 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Pricings.java @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.PricingInner; + +/** Resource collection API of Pricings. */ +public interface Pricings { + /** + * Lists Security Center pricing configurations in the subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of pricing configurations response. + */ + PricingList list(); + + /** + * Lists Security Center pricing configurations in the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of pricing configurations response. + */ + Response listWithResponse(Context context); + + /** + * Gets a provided Security Center pricing configuration in the subscription. + * + * @param pricingName name of the pricing configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a provided Security Center pricing configuration in the subscription. + */ + Pricing get(String pricingName); + + /** + * Gets a provided Security Center pricing configuration in the subscription. + * + * @param pricingName name of the pricing configuration. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a provided Security Center pricing configuration in the subscription. + */ + Response getWithResponse(String pricingName, Context context); + + /** + * Updates a provided Security Center pricing configuration in the subscription. + * + * @param pricingName name of the pricing configuration. + * @param pricing Pricing object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure Security Center is provided in two pricing tiers: free and standard, with the standard tier + * available with a trial period. + */ + Pricing update(String pricingName, PricingInner pricing); + + /** + * Updates a provided Security Center pricing configuration in the subscription. + * + * @param pricingName name of the pricing configuration. + * @param pricing Pricing object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure Security Center is provided in two pricing tiers: free and standard, with the standard tier + * available with a trial period. + */ + Response updateWithResponse(String pricingName, PricingInner pricing, Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ProcessNotAllowed.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ProcessNotAllowed.java new file mode 100644 index 000000000000..910e80de9cea --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ProcessNotAllowed.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.util.List; + +/** Execution of a process that isn't allowed. Allow list consists of process names to allow. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "ruleType") +@JsonTypeName("ProcessNotAllowed") +@Fluent +public final class ProcessNotAllowed extends AllowlistCustomAlertRule { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ProcessNotAllowed.class); + + /** {@inheritDoc} */ + @Override + public ProcessNotAllowed withAllowlistValues(List allowlistValues) { + super.withAllowlistValues(allowlistValues); + return this; + } + + /** {@inheritDoc} */ + @Override + public ProcessNotAllowed withIsEnabled(boolean isEnabled) { + super.withIsEnabled(isEnabled); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ProgrammingState.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ProgrammingState.java new file mode 100644 index 000000000000..fac05da58c0c --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ProgrammingState.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ProgrammingState. */ +public final class ProgrammingState extends ExpandableStringEnum { + /** Static value ProgrammingDevice for ProgrammingState. */ + public static final ProgrammingState PROGRAMMING_DEVICE = fromString("ProgrammingDevice"); + + /** Static value NotProgrammingDevice for ProgrammingState. */ + public static final ProgrammingState NOT_PROGRAMMING_DEVICE = fromString("NotProgrammingDevice"); + + /** + * Creates or finds a ProgrammingState from its string representation. + * + * @param name a name to look for. + * @return the corresponding ProgrammingState. + */ + @JsonCreator + public static ProgrammingState fromString(String name) { + return fromString(name, ProgrammingState.class); + } + + /** @return known ProgrammingState values. */ + public static Collection values() { + return values(ProgrammingState.class); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/PropertyType.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/PropertyType.java new file mode 100644 index 000000000000..b0146fec3848 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/PropertyType.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for PropertyType. */ +public final class PropertyType extends ExpandableStringEnum { + /** Static value String for PropertyType. */ + public static final PropertyType STRING = fromString("String"); + + /** Static value Integer for PropertyType. */ + public static final PropertyType INTEGER = fromString("Integer"); + + /** Static value Number for PropertyType. */ + public static final PropertyType NUMBER = fromString("Number"); + + /** Static value Boolean for PropertyType. */ + public static final PropertyType BOOLEAN = fromString("Boolean"); + + /** + * Creates or finds a PropertyType from its string representation. + * + * @param name a name to look for. + * @return the corresponding PropertyType. + */ + @JsonCreator + public static PropertyType fromString(String name) { + return fromString(name, PropertyType.class); + } + + /** @return known PropertyType values. */ + public static Collection values() { + return values(PropertyType.class); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ProtectionMode.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ProtectionMode.java new file mode 100644 index 000000000000..c34a1534fd24 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ProtectionMode.java @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The protection mode of the collection/file types. Exe/Msi/Script are used for Windows, Executable is used for Linux. + */ +@Fluent +public final class ProtectionMode { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ProtectionMode.class); + + /* + * The application control policy enforcement/protection mode of the + * machine group + */ + @JsonProperty(value = "exe") + private EnforcementMode exe; + + /* + * The application control policy enforcement/protection mode of the + * machine group + */ + @JsonProperty(value = "msi") + private EnforcementMode msi; + + /* + * The application control policy enforcement/protection mode of the + * machine group + */ + @JsonProperty(value = "script") + private EnforcementMode script; + + /* + * The application control policy enforcement/protection mode of the + * machine group + */ + @JsonProperty(value = "executable") + private EnforcementMode executable; + + /** + * Get the exe property: The application control policy enforcement/protection mode of the machine group. + * + * @return the exe value. + */ + public EnforcementMode exe() { + return this.exe; + } + + /** + * Set the exe property: The application control policy enforcement/protection mode of the machine group. + * + * @param exe the exe value to set. + * @return the ProtectionMode object itself. + */ + public ProtectionMode withExe(EnforcementMode exe) { + this.exe = exe; + return this; + } + + /** + * Get the msi property: The application control policy enforcement/protection mode of the machine group. + * + * @return the msi value. + */ + public EnforcementMode msi() { + return this.msi; + } + + /** + * Set the msi property: The application control policy enforcement/protection mode of the machine group. + * + * @param msi the msi value to set. + * @return the ProtectionMode object itself. + */ + public ProtectionMode withMsi(EnforcementMode msi) { + this.msi = msi; + return this; + } + + /** + * Get the script property: The application control policy enforcement/protection mode of the machine group. + * + * @return the script value. + */ + public EnforcementMode script() { + return this.script; + } + + /** + * Set the script property: The application control policy enforcement/protection mode of the machine group. + * + * @param script the script value to set. + * @return the ProtectionMode object itself. + */ + public ProtectionMode withScript(EnforcementMode script) { + this.script = script; + return this; + } + + /** + * Get the executable property: The application control policy enforcement/protection mode of the machine group. + * + * @return the executable value. + */ + public EnforcementMode executable() { + return this.executable; + } + + /** + * Set the executable property: The application control policy enforcement/protection mode of the machine group. + * + * @param executable the executable value to set. + * @return the ProtectionMode object itself. + */ + public ProtectionMode withExecutable(EnforcementMode executable) { + this.executable = executable; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Protocol.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Protocol.java new file mode 100644 index 000000000000..497e6a32c476 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Protocol.java @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Protocol data. */ +@Fluent +public final class Protocol { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Protocol.class); + + /* + * Protocol name + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * list of protocol identifiers. + */ + @JsonProperty(value = "identifiers") + private String identifiers; + + /** + * Get the name property: Protocol name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the identifiers property: list of protocol identifiers. + * + * @return the identifiers value. + */ + public String identifiers() { + return this.identifiers; + } + + /** + * Set the identifiers property: list of protocol identifiers. + * + * @param identifiers the identifiers value to set. + * @return the Protocol object itself. + */ + public Protocol withIdentifiers(String identifiers) { + this.identifiers = identifiers; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ProtocolValue.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ProtocolValue.java new file mode 100644 index 000000000000..2aa321e30d7f --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ProtocolValue.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ProtocolValue. */ +public final class ProtocolValue extends ExpandableStringEnum { + /** Static value TCP for ProtocolValue. */ + public static final ProtocolValue TCP = fromString("TCP"); + + /** Static value UDP for ProtocolValue. */ + public static final ProtocolValue UDP = fromString("UDP"); + + /** Static value * for ProtocolValue. */ + public static final ProtocolValue ASTERISK = fromString("*"); + + /** + * Creates or finds a ProtocolValue from its string representation. + * + * @param name a name to look for. + * @return the corresponding ProtocolValue. + */ + @JsonCreator + public static ProtocolValue fromString(String name) { + return fromString(name, ProtocolValue.class); + } + + /** @return known ProtocolValue values. */ + public static Collection values() { + return values(ProtocolValue.class); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ProvisioningState.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ProvisioningState.java new file mode 100644 index 000000000000..87ac9f4ff5ce --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ProvisioningState.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ProvisioningState. */ +public final class ProvisioningState extends ExpandableStringEnum { + /** Static value Succeeded for ProvisioningState. */ + public static final ProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** Static value Failed for ProvisioningState. */ + public static final ProvisioningState FAILED = fromString("Failed"); + + /** Static value Updating for ProvisioningState. */ + public static final ProvisioningState UPDATING = fromString("Updating"); + + /** + * Creates or finds a ProvisioningState from its string representation. + * + * @param name a name to look for. + * @return the corresponding ProvisioningState. + */ + @JsonCreator + public static ProvisioningState fromString(String name) { + return fromString(name, ProvisioningState.class); + } + + /** @return known ProvisioningState values. */ + public static Collection values() { + return values(ProvisioningState.class); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ProxyServerProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ProxyServerProperties.java new file mode 100644 index 000000000000..ec7ef0512976 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ProxyServerProperties.java @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * For a non-Azure machine that is not connected directly to the internet, specify a proxy server that the non-Azure + * machine can use. + */ +@Fluent +public final class ProxyServerProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ProxyServerProperties.class); + + /* + * Proxy server IP + */ + @JsonProperty(value = "ip") + private String ip; + + /* + * Proxy server port + */ + @JsonProperty(value = "port") + private String port; + + /** + * Get the ip property: Proxy server IP. + * + * @return the ip value. + */ + public String ip() { + return this.ip; + } + + /** + * Set the ip property: Proxy server IP. + * + * @param ip the ip value to set. + * @return the ProxyServerProperties object itself. + */ + public ProxyServerProperties withIp(String ip) { + this.ip = ip; + return this; + } + + /** + * Get the port property: Proxy server port. + * + * @return the port value. + */ + public String port() { + return this.port; + } + + /** + * Set the port property: Proxy server port. + * + * @param port the port value to set. + * @return the ProxyServerProperties object itself. + */ + public ProxyServerProperties withPort(String port) { + this.port = port; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/PublisherInfo.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/PublisherInfo.java new file mode 100644 index 000000000000..417c420485b2 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/PublisherInfo.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Represents the publisher information of a process/rule. */ +@Fluent +public final class PublisherInfo { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PublisherInfo.class); + + /* + * The Subject field of the x.509 certificate used to sign the code, using + * the following fields - O = Organization, L = Locality, S = State or + * Province, and C = Country + */ + @JsonProperty(value = "publisherName") + private String publisherName; + + /* + * The product name taken from the file's version resource + */ + @JsonProperty(value = "productName") + private String productName; + + /* + * The "OriginalName" field taken from the file's version resource + */ + @JsonProperty(value = "binaryName") + private String binaryName; + + /* + * The binary file version taken from the file's version resource + */ + @JsonProperty(value = "version") + private String version; + + /** + * Get the publisherName property: The Subject field of the x.509 certificate used to sign the code, using the + * following fields - O = Organization, L = Locality, S = State or Province, and C = Country. + * + * @return the publisherName value. + */ + public String publisherName() { + return this.publisherName; + } + + /** + * Set the publisherName property: The Subject field of the x.509 certificate used to sign the code, using the + * following fields - O = Organization, L = Locality, S = State or Province, and C = Country. + * + * @param publisherName the publisherName value to set. + * @return the PublisherInfo object itself. + */ + public PublisherInfo withPublisherName(String publisherName) { + this.publisherName = publisherName; + return this; + } + + /** + * Get the productName property: The product name taken from the file's version resource. + * + * @return the productName value. + */ + public String productName() { + return this.productName; + } + + /** + * Set the productName property: The product name taken from the file's version resource. + * + * @param productName the productName value to set. + * @return the PublisherInfo object itself. + */ + public PublisherInfo withProductName(String productName) { + this.productName = productName; + return this; + } + + /** + * Get the binaryName property: The "OriginalName" field taken from the file's version resource. + * + * @return the binaryName value. + */ + public String binaryName() { + return this.binaryName; + } + + /** + * Set the binaryName property: The "OriginalName" field taken from the file's version resource. + * + * @param binaryName the binaryName value to set. + * @return the PublisherInfo object itself. + */ + public PublisherInfo withBinaryName(String binaryName) { + this.binaryName = binaryName; + return this; + } + + /** + * Get the version property: The binary file version taken from the file's version resource. + * + * @return the version value. + */ + public String version() { + return this.version; + } + + /** + * Set the version property: The binary file version taken from the file's version resource. + * + * @param version the version value to set. + * @return the PublisherInfo object itself. + */ + public PublisherInfo withVersion(String version) { + this.version = version; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/PurdueLevel.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/PurdueLevel.java new file mode 100644 index 000000000000..5a076100d3a3 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/PurdueLevel.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for PurdueLevel. */ +public final class PurdueLevel extends ExpandableStringEnum { + /** Static value ProcessControl for PurdueLevel. */ + public static final PurdueLevel PROCESS_CONTROL = fromString("ProcessControl"); + + /** Static value Supervisory for PurdueLevel. */ + public static final PurdueLevel SUPERVISORY = fromString("Supervisory"); + + /** Static value Enterprise for PurdueLevel. */ + public static final PurdueLevel ENTERPRISE = fromString("Enterprise"); + + /** + * Creates or finds a PurdueLevel from its string representation. + * + * @param name a name to look for. + * @return the corresponding PurdueLevel. + */ + @JsonCreator + public static PurdueLevel fromString(String name) { + return fromString(name, PurdueLevel.class); + } + + /** @return known PurdueLevel values. */ + public static Collection values() { + return values(PurdueLevel.class); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/QueryCheck.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/QueryCheck.java new file mode 100644 index 000000000000..7d0d9193f5b5 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/QueryCheck.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The rule query details. */ +@Fluent +public final class QueryCheck { + @JsonIgnore private final ClientLogger logger = new ClientLogger(QueryCheck.class); + + /* + * The rule query. + */ + @JsonProperty(value = "query") + private String query; + + /* + * Expected result. + */ + @JsonProperty(value = "expectedResult") + private List> expectedResult; + + /* + * Column names of expected result. + */ + @JsonProperty(value = "columnNames") + private List columnNames; + + /** + * Get the query property: The rule query. + * + * @return the query value. + */ + public String query() { + return this.query; + } + + /** + * Set the query property: The rule query. + * + * @param query the query value to set. + * @return the QueryCheck object itself. + */ + public QueryCheck withQuery(String query) { + this.query = query; + return this; + } + + /** + * Get the expectedResult property: Expected result. + * + * @return the expectedResult value. + */ + public List> expectedResult() { + return this.expectedResult; + } + + /** + * Set the expectedResult property: Expected result. + * + * @param expectedResult the expectedResult value to set. + * @return the QueryCheck object itself. + */ + public QueryCheck withExpectedResult(List> expectedResult) { + this.expectedResult = expectedResult; + return this; + } + + /** + * Get the columnNames property: Column names of expected result. + * + * @return the columnNames value. + */ + public List columnNames() { + return this.columnNames; + } + + /** + * Set the columnNames property: Column names of expected result. + * + * @param columnNames the columnNames value to set. + * @return the QueryCheck object itself. + */ + public QueryCheck withColumnNames(List columnNames) { + this.columnNames = columnNames; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/QueuePurgesNotInAllowedRange.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/QueuePurgesNotInAllowedRange.java new file mode 100644 index 000000000000..1a9138a63e44 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/QueuePurgesNotInAllowedRange.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.time.Duration; + +/** Number of device queue purges is not in allowed range. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "ruleType") +@JsonTypeName("QueuePurgesNotInAllowedRange") +@Fluent +public final class QueuePurgesNotInAllowedRange extends TimeWindowCustomAlertRule { + @JsonIgnore private final ClientLogger logger = new ClientLogger(QueuePurgesNotInAllowedRange.class); + + /** {@inheritDoc} */ + @Override + public QueuePurgesNotInAllowedRange withTimeWindowSize(Duration timeWindowSize) { + super.withTimeWindowSize(timeWindowSize); + return this; + } + + /** {@inheritDoc} */ + @Override + public QueuePurgesNotInAllowedRange withMinThreshold(int minThreshold) { + super.withMinThreshold(minThreshold); + return this; + } + + /** {@inheritDoc} */ + @Override + public QueuePurgesNotInAllowedRange withMaxThreshold(int maxThreshold) { + super.withMaxThreshold(maxThreshold); + return this; + } + + /** {@inheritDoc} */ + @Override + public QueuePurgesNotInAllowedRange withIsEnabled(boolean isEnabled) { + super.withIsEnabled(isEnabled); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Rank.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Rank.java new file mode 100644 index 000000000000..4ac61ff5dd5b --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Rank.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for Rank. */ +public enum Rank { + /** Enum value None. */ + NONE("None"), + + /** Enum value Low. */ + LOW("Low"), + + /** Enum value Medium. */ + MEDIUM("Medium"), + + /** Enum value High. */ + HIGH("High"), + + /** Enum value Critical. */ + CRITICAL("Critical"); + + /** The actual serialized value for a Rank instance. */ + private final String value; + + Rank(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a Rank instance. + * + * @param value the serialized value to parse. + * @return the parsed Rank object, or null if unable to parse. + */ + @JsonCreator + public static Rank fromString(String value) { + Rank[] items = Rank.values(); + for (Rank item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/RecommendationAction.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/RecommendationAction.java new file mode 100644 index 000000000000..fa705d1aa872 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/RecommendationAction.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for RecommendationAction. */ +public final class RecommendationAction extends ExpandableStringEnum { + /** Static value Recommended for RecommendationAction. */ + public static final RecommendationAction RECOMMENDED = fromString("Recommended"); + + /** Static value Add for RecommendationAction. */ + public static final RecommendationAction ADD = fromString("Add"); + + /** Static value Remove for RecommendationAction. */ + public static final RecommendationAction REMOVE = fromString("Remove"); + + /** + * Creates or finds a RecommendationAction from its string representation. + * + * @param name a name to look for. + * @return the corresponding RecommendationAction. + */ + @JsonCreator + public static RecommendationAction fromString(String name) { + return fromString(name, RecommendationAction.class); + } + + /** @return known RecommendationAction values. */ + public static Collection values() { + return values(RecommendationAction.class); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/RecommendationConfigStatus.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/RecommendationConfigStatus.java new file mode 100644 index 000000000000..abbe8388e9d1 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/RecommendationConfigStatus.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for RecommendationConfigStatus. */ +public final class RecommendationConfigStatus extends ExpandableStringEnum { + /** Static value Disabled for RecommendationConfigStatus. */ + public static final RecommendationConfigStatus DISABLED = fromString("Disabled"); + + /** Static value Enabled for RecommendationConfigStatus. */ + public static final RecommendationConfigStatus ENABLED = fromString("Enabled"); + + /** + * Creates or finds a RecommendationConfigStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding RecommendationConfigStatus. + */ + @JsonCreator + public static RecommendationConfigStatus fromString(String name) { + return fromString(name, RecommendationConfigStatus.class); + } + + /** @return known RecommendationConfigStatus values. */ + public static Collection values() { + return values(RecommendationConfigStatus.class); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/RecommendationConfigurationProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/RecommendationConfigurationProperties.java new file mode 100644 index 000000000000..892a13668957 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/RecommendationConfigurationProperties.java @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The type of IoT Security recommendation. */ +@Fluent +public final class RecommendationConfigurationProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RecommendationConfigurationProperties.class); + + /* + * The type of IoT Security recommendation. + */ + @JsonProperty(value = "recommendationType", required = true) + private RecommendationType recommendationType; + + /* + * The name property. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * Recommendation status. When the recommendation status is disabled + * recommendations are not generated. + */ + @JsonProperty(value = "status", required = true) + private RecommendationConfigStatus status; + + /** + * Get the recommendationType property: The type of IoT Security recommendation. + * + * @return the recommendationType value. + */ + public RecommendationType recommendationType() { + return this.recommendationType; + } + + /** + * Set the recommendationType property: The type of IoT Security recommendation. + * + * @param recommendationType the recommendationType value to set. + * @return the RecommendationConfigurationProperties object itself. + */ + public RecommendationConfigurationProperties withRecommendationType(RecommendationType recommendationType) { + this.recommendationType = recommendationType; + return this; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the status property: Recommendation status. When the recommendation status is disabled recommendations are + * not generated. + * + * @return the status value. + */ + public RecommendationConfigStatus status() { + return this.status; + } + + /** + * Set the status property: Recommendation status. When the recommendation status is disabled recommendations are + * not generated. + * + * @param status the status value to set. + * @return the RecommendationConfigurationProperties object itself. + */ + public RecommendationConfigurationProperties withStatus(RecommendationConfigStatus status) { + this.status = status; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (recommendationType() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property recommendationType in model RecommendationConfigurationProperties")); + } + if (status() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property status in model RecommendationConfigurationProperties")); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/RecommendationSeverity.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/RecommendationSeverity.java new file mode 100644 index 000000000000..fb8f34770803 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/RecommendationSeverity.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for RecommendationSeverity. */ +public final class RecommendationSeverity extends ExpandableStringEnum { + /** Static value Unknown for RecommendationSeverity. */ + public static final RecommendationSeverity UNKNOWN = fromString("Unknown"); + + /** Static value NotApplicable for RecommendationSeverity. */ + public static final RecommendationSeverity NOT_APPLICABLE = fromString("NotApplicable"); + + /** Static value Healthy for RecommendationSeverity. */ + public static final RecommendationSeverity HEALTHY = fromString("Healthy"); + + /** Static value OffByPolicy for RecommendationSeverity. */ + public static final RecommendationSeverity OFF_BY_POLICY = fromString("OffByPolicy"); + + /** Static value Low for RecommendationSeverity. */ + public static final RecommendationSeverity LOW = fromString("Low"); + + /** Static value Medium for RecommendationSeverity. */ + public static final RecommendationSeverity MEDIUM = fromString("Medium"); + + /** Static value High for RecommendationSeverity. */ + public static final RecommendationSeverity HIGH = fromString("High"); + + /** + * Creates or finds a RecommendationSeverity from its string representation. + * + * @param name a name to look for. + * @return the corresponding RecommendationSeverity. + */ + @JsonCreator + public static RecommendationSeverity fromString(String name) { + return fromString(name, RecommendationSeverity.class); + } + + /** @return known RecommendationSeverity values. */ + public static Collection values() { + return values(RecommendationSeverity.class); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/RecommendationStatus.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/RecommendationStatus.java new file mode 100644 index 000000000000..a5128f2abbb2 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/RecommendationStatus.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for RecommendationStatus. */ +public final class RecommendationStatus extends ExpandableStringEnum { + /** Static value Recommended for RecommendationStatus. */ + public static final RecommendationStatus RECOMMENDED = fromString("Recommended"); + + /** Static value NotRecommended for RecommendationStatus. */ + public static final RecommendationStatus NOT_RECOMMENDED = fromString("NotRecommended"); + + /** Static value NotAvailable for RecommendationStatus. */ + public static final RecommendationStatus NOT_AVAILABLE = fromString("NotAvailable"); + + /** Static value NoStatus for RecommendationStatus. */ + public static final RecommendationStatus NO_STATUS = fromString("NoStatus"); + + /** + * Creates or finds a RecommendationStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding RecommendationStatus. + */ + @JsonCreator + public static RecommendationStatus fromString(String name) { + return fromString(name, RecommendationStatus.class); + } + + /** @return known RecommendationStatus values. */ + public static Collection values() { + return values(RecommendationStatus.class); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/RecommendationType.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/RecommendationType.java new file mode 100644 index 000000000000..124aa43b0dbd --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/RecommendationType.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for RecommendationType. */ +public final class RecommendationType extends ExpandableStringEnum { + /** Static value IoT_ACRAuthentication for RecommendationType. */ + public static final RecommendationType IO_T_ACRAUTHENTICATION = fromString("IoT_ACRAuthentication"); + + /** Static value IoT_AgentSendsUnutilizedMessages for RecommendationType. */ + public static final RecommendationType IO_T_AGENT_SENDS_UNUTILIZED_MESSAGES = + fromString("IoT_AgentSendsUnutilizedMessages"); + + /** Static value IoT_Baseline for RecommendationType. */ + public static final RecommendationType IO_T_BASELINE = fromString("IoT_Baseline"); + + /** Static value IoT_EdgeHubMemOptimize for RecommendationType. */ + public static final RecommendationType IO_T_EDGE_HUB_MEM_OPTIMIZE = fromString("IoT_EdgeHubMemOptimize"); + + /** Static value IoT_EdgeLoggingOptions for RecommendationType. */ + public static final RecommendationType IO_T_EDGE_LOGGING_OPTIONS = fromString("IoT_EdgeLoggingOptions"); + + /** Static value IoT_InconsistentModuleSettings for RecommendationType. */ + public static final RecommendationType IO_T_INCONSISTENT_MODULE_SETTINGS = + fromString("IoT_InconsistentModuleSettings"); + + /** Static value IoT_InstallAgent for RecommendationType. */ + public static final RecommendationType IO_T_INSTALL_AGENT = fromString("IoT_InstallAgent"); + + /** Static value IoT_IPFilter_DenyAll for RecommendationType. */ + public static final RecommendationType IO_T_IPFILTER_DENY_ALL = fromString("IoT_IPFilter_DenyAll"); + + /** Static value IoT_IPFilter_PermissiveRule for RecommendationType. */ + public static final RecommendationType IO_T_IPFILTER_PERMISSIVE_RULE = fromString("IoT_IPFilter_PermissiveRule"); + + /** Static value IoT_OpenPorts for RecommendationType. */ + public static final RecommendationType IO_T_OPEN_PORTS = fromString("IoT_OpenPorts"); + + /** Static value IoT_PermissiveFirewallPolicy for RecommendationType. */ + public static final RecommendationType IO_T_PERMISSIVE_FIREWALL_POLICY = fromString("IoT_PermissiveFirewallPolicy"); + + /** Static value IoT_PermissiveInputFirewallRules for RecommendationType. */ + public static final RecommendationType IO_T_PERMISSIVE_INPUT_FIREWALL_RULES = + fromString("IoT_PermissiveInputFirewallRules"); + + /** Static value IoT_PermissiveOutputFirewallRules for RecommendationType. */ + public static final RecommendationType IO_T_PERMISSIVE_OUTPUT_FIREWALL_RULES = + fromString("IoT_PermissiveOutputFirewallRules"); + + /** Static value IoT_PrivilegedDockerOptions for RecommendationType. */ + public static final RecommendationType IO_T_PRIVILEGED_DOCKER_OPTIONS = fromString("IoT_PrivilegedDockerOptions"); + + /** Static value IoT_SharedCredentials for RecommendationType. */ + public static final RecommendationType IO_T_SHARED_CREDENTIALS = fromString("IoT_SharedCredentials"); + + /** Static value IoT_VulnerableTLSCipherSuite for RecommendationType. */ + public static final RecommendationType IO_T_VULNERABLE_TLSCIPHER_SUITE = fromString("IoT_VulnerableTLSCipherSuite"); + + /** + * Creates or finds a RecommendationType from its string representation. + * + * @param name a name to look for. + * @return the corresponding RecommendationType. + */ + @JsonCreator + public static RecommendationType fromString(String name) { + return fromString(name, RecommendationType.class); + } + + /** @return known RecommendationType values. */ + public static Collection values() { + return values(RecommendationType.class); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/RegulatoryComplianceAssessment.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/RegulatoryComplianceAssessment.java new file mode 100644 index 000000000000..9ae45994128f --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/RegulatoryComplianceAssessment.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.resourcemanager.security.fluent.models.RegulatoryComplianceAssessmentInner; + +/** An immutable client-side representation of RegulatoryComplianceAssessment. */ +public interface RegulatoryComplianceAssessment { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the description property: The description of the regulatory compliance assessment. + * + * @return the description value. + */ + String description(); + + /** + * Gets the assessmentType property: The expected type of assessment contained in the AssessmentDetailsLink. + * + * @return the assessmentType value. + */ + String assessmentType(); + + /** + * Gets the assessmentDetailsLink property: Link to more detailed assessment results data. The response type will be + * according to the assessmentType field. + * + * @return the assessmentDetailsLink value. + */ + String assessmentDetailsLink(); + + /** + * Gets the state property: Aggregative state based on the assessment's scanned resources states. + * + * @return the state value. + */ + State state(); + + /** + * Gets the passedResources property: The given assessment's related resources count with passed state. + * + * @return the passedResources value. + */ + Integer passedResources(); + + /** + * Gets the failedResources property: The given assessment's related resources count with failed state. + * + * @return the failedResources value. + */ + Integer failedResources(); + + /** + * Gets the skippedResources property: The given assessment's related resources count with skipped state. + * + * @return the skippedResources value. + */ + Integer skippedResources(); + + /** + * Gets the unsupportedResources property: The given assessment's related resources count with unsupported state. + * + * @return the unsupportedResources value. + */ + Integer unsupportedResources(); + + /** + * Gets the inner com.azure.resourcemanager.security.fluent.models.RegulatoryComplianceAssessmentInner object. + * + * @return the inner object. + */ + RegulatoryComplianceAssessmentInner innerModel(); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/RegulatoryComplianceAssessmentList.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/RegulatoryComplianceAssessmentList.java new file mode 100644 index 000000000000..95eb77b0f2a7 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/RegulatoryComplianceAssessmentList.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.models.RegulatoryComplianceAssessmentInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of regulatory compliance assessment response. */ +@Fluent +public final class RegulatoryComplianceAssessmentList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RegulatoryComplianceAssessmentList.class); + + /* + * The value property. + */ + @JsonProperty(value = "value", required = true) + private List value; + + /* + * The URI to fetch the next page. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: The value property. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The value property. + * + * @param value the value value to set. + * @return the RegulatoryComplianceAssessmentList object itself. + */ + public RegulatoryComplianceAssessmentList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The URI to fetch the next page. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property value in model RegulatoryComplianceAssessmentList")); + } else { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/RegulatoryComplianceAssessments.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/RegulatoryComplianceAssessments.java new file mode 100644 index 000000000000..da7a25cfa3f6 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/RegulatoryComplianceAssessments.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of RegulatoryComplianceAssessments. */ +public interface RegulatoryComplianceAssessments { + /** + * Details and state of assessments mapped to selected regulatory compliance control. + * + * @param regulatoryComplianceStandardName Name of the regulatory compliance standard object. + * @param regulatoryComplianceControlName Name of the regulatory compliance control object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of regulatory compliance assessment response. + */ + PagedIterable list( + String regulatoryComplianceStandardName, String regulatoryComplianceControlName); + + /** + * Details and state of assessments mapped to selected regulatory compliance control. + * + * @param regulatoryComplianceStandardName Name of the regulatory compliance standard object. + * @param regulatoryComplianceControlName Name of the regulatory compliance control object. + * @param filter OData filter. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of regulatory compliance assessment response. + */ + PagedIterable list( + String regulatoryComplianceStandardName, + String regulatoryComplianceControlName, + String filter, + Context context); + + /** + * Supported regulatory compliance details and state for selected assessment. + * + * @param regulatoryComplianceStandardName Name of the regulatory compliance standard object. + * @param regulatoryComplianceControlName Name of the regulatory compliance control object. + * @param regulatoryComplianceAssessmentName Name of the regulatory compliance assessment object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return regulatory compliance assessment details and state. + */ + RegulatoryComplianceAssessment get( + String regulatoryComplianceStandardName, + String regulatoryComplianceControlName, + String regulatoryComplianceAssessmentName); + + /** + * Supported regulatory compliance details and state for selected assessment. + * + * @param regulatoryComplianceStandardName Name of the regulatory compliance standard object. + * @param regulatoryComplianceControlName Name of the regulatory compliance control object. + * @param regulatoryComplianceAssessmentName Name of the regulatory compliance assessment object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return regulatory compliance assessment details and state. + */ + Response getWithResponse( + String regulatoryComplianceStandardName, + String regulatoryComplianceControlName, + String regulatoryComplianceAssessmentName, + Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/RegulatoryComplianceControl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/RegulatoryComplianceControl.java new file mode 100644 index 000000000000..caaee9f72e04 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/RegulatoryComplianceControl.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.resourcemanager.security.fluent.models.RegulatoryComplianceControlInner; + +/** An immutable client-side representation of RegulatoryComplianceControl. */ +public interface RegulatoryComplianceControl { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the description property: The description of the regulatory compliance control. + * + * @return the description value. + */ + String description(); + + /** + * Gets the state property: Aggregative state based on the control's supported assessments states. + * + * @return the state value. + */ + State state(); + + /** + * Gets the passedAssessments property: The number of supported regulatory compliance assessments of the given + * control with a passed state. + * + * @return the passedAssessments value. + */ + Integer passedAssessments(); + + /** + * Gets the failedAssessments property: The number of supported regulatory compliance assessments of the given + * control with a failed state. + * + * @return the failedAssessments value. + */ + Integer failedAssessments(); + + /** + * Gets the skippedAssessments property: The number of supported regulatory compliance assessments of the given + * control with a skipped state. + * + * @return the skippedAssessments value. + */ + Integer skippedAssessments(); + + /** + * Gets the inner com.azure.resourcemanager.security.fluent.models.RegulatoryComplianceControlInner object. + * + * @return the inner object. + */ + RegulatoryComplianceControlInner innerModel(); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/RegulatoryComplianceControlList.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/RegulatoryComplianceControlList.java new file mode 100644 index 000000000000..f0ef4b549903 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/RegulatoryComplianceControlList.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.models.RegulatoryComplianceControlInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of regulatory compliance controls response. */ +@Fluent +public final class RegulatoryComplianceControlList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RegulatoryComplianceControlList.class); + + /* + * List of regulatory compliance controls + */ + @JsonProperty(value = "value", required = true) + private List value; + + /* + * The URI to fetch the next page. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: List of regulatory compliance controls. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: List of regulatory compliance controls. + * + * @param value the value value to set. + * @return the RegulatoryComplianceControlList object itself. + */ + public RegulatoryComplianceControlList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The URI to fetch the next page. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property value in model RegulatoryComplianceControlList")); + } else { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/RegulatoryComplianceControls.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/RegulatoryComplianceControls.java new file mode 100644 index 000000000000..6562b9807503 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/RegulatoryComplianceControls.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of RegulatoryComplianceControls. */ +public interface RegulatoryComplianceControls { + /** + * All supported regulatory compliance controls details and state for selected standard. + * + * @param regulatoryComplianceStandardName Name of the regulatory compliance standard object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of regulatory compliance controls response. + */ + PagedIterable list(String regulatoryComplianceStandardName); + + /** + * All supported regulatory compliance controls details and state for selected standard. + * + * @param regulatoryComplianceStandardName Name of the regulatory compliance standard object. + * @param filter OData filter. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of regulatory compliance controls response. + */ + PagedIterable list( + String regulatoryComplianceStandardName, String filter, Context context); + + /** + * Selected regulatory compliance control details and state. + * + * @param regulatoryComplianceStandardName Name of the regulatory compliance standard object. + * @param regulatoryComplianceControlName Name of the regulatory compliance control object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return regulatory compliance control details and state. + */ + RegulatoryComplianceControl get(String regulatoryComplianceStandardName, String regulatoryComplianceControlName); + + /** + * Selected regulatory compliance control details and state. + * + * @param regulatoryComplianceStandardName Name of the regulatory compliance standard object. + * @param regulatoryComplianceControlName Name of the regulatory compliance control object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return regulatory compliance control details and state. + */ + Response getWithResponse( + String regulatoryComplianceStandardName, String regulatoryComplianceControlName, Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/RegulatoryComplianceStandard.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/RegulatoryComplianceStandard.java new file mode 100644 index 000000000000..fce9414f4172 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/RegulatoryComplianceStandard.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.resourcemanager.security.fluent.models.RegulatoryComplianceStandardInner; + +/** An immutable client-side representation of RegulatoryComplianceStandard. */ +public interface RegulatoryComplianceStandard { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the state property: Aggregative state based on the standard's supported controls states. + * + * @return the state value. + */ + State state(); + + /** + * Gets the passedControls property: The number of supported regulatory compliance controls of the given standard + * with a passed state. + * + * @return the passedControls value. + */ + Integer passedControls(); + + /** + * Gets the failedControls property: The number of supported regulatory compliance controls of the given standard + * with a failed state. + * + * @return the failedControls value. + */ + Integer failedControls(); + + /** + * Gets the skippedControls property: The number of supported regulatory compliance controls of the given standard + * with a skipped state. + * + * @return the skippedControls value. + */ + Integer skippedControls(); + + /** + * Gets the unsupportedControls property: The number of regulatory compliance controls of the given standard which + * are unsupported by automated assessments. + * + * @return the unsupportedControls value. + */ + Integer unsupportedControls(); + + /** + * Gets the inner com.azure.resourcemanager.security.fluent.models.RegulatoryComplianceStandardInner object. + * + * @return the inner object. + */ + RegulatoryComplianceStandardInner innerModel(); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/RegulatoryComplianceStandardList.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/RegulatoryComplianceStandardList.java new file mode 100644 index 000000000000..a4d68aec9088 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/RegulatoryComplianceStandardList.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.models.RegulatoryComplianceStandardInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of regulatory compliance standards response. */ +@Fluent +public final class RegulatoryComplianceStandardList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RegulatoryComplianceStandardList.class); + + /* + * The value property. + */ + @JsonProperty(value = "value", required = true) + private List value; + + /* + * The URI to fetch the next page. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: The value property. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The value property. + * + * @param value the value value to set. + * @return the RegulatoryComplianceStandardList object itself. + */ + public RegulatoryComplianceStandardList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The URI to fetch the next page. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property value in model RegulatoryComplianceStandardList")); + } else { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/RegulatoryComplianceStandards.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/RegulatoryComplianceStandards.java new file mode 100644 index 000000000000..093358e2e5cf --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/RegulatoryComplianceStandards.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of RegulatoryComplianceStandards. */ +public interface RegulatoryComplianceStandards { + /** + * Supported regulatory compliance standards details and state. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of regulatory compliance standards response. + */ + PagedIterable list(); + + /** + * Supported regulatory compliance standards details and state. + * + * @param filter OData filter. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of regulatory compliance standards response. + */ + PagedIterable list(String filter, Context context); + + /** + * Supported regulatory compliance details state for selected standard. + * + * @param regulatoryComplianceStandardName Name of the regulatory compliance standard object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return regulatory compliance standard details and state. + */ + RegulatoryComplianceStandard get(String regulatoryComplianceStandardName); + + /** + * Supported regulatory compliance details state for selected standard. + * + * @param regulatoryComplianceStandardName Name of the regulatory compliance standard object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return regulatory compliance standard details and state. + */ + Response getWithResponse(String regulatoryComplianceStandardName, Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/RelationToIpStatus.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/RelationToIpStatus.java new file mode 100644 index 000000000000..947a32eabacd --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/RelationToIpStatus.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for RelationToIpStatus. */ +public final class RelationToIpStatus extends ExpandableStringEnum { + /** Static value Guess for RelationToIpStatus. */ + public static final RelationToIpStatus GUESS = fromString("Guess"); + + /** Static value Certain for RelationToIpStatus. */ + public static final RelationToIpStatus CERTAIN = fromString("Certain"); + + /** + * Creates or finds a RelationToIpStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding RelationToIpStatus. + */ + @JsonCreator + public static RelationToIpStatus fromString(String name) { + return fromString(name, RelationToIpStatus.class); + } + + /** @return known RelationToIpStatus values. */ + public static Collection values() { + return values(RelationToIpStatus.class); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Remediation.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Remediation.java new file mode 100644 index 000000000000..8de837a88ec4 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Remediation.java @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Remediation details. */ +@Fluent +public final class Remediation { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Remediation.class); + + /* + * Remediation description. + */ + @JsonProperty(value = "description") + private String description; + + /* + * Remediation script. + */ + @JsonProperty(value = "scripts") + private List scripts; + + /* + * Is remediation automated. + */ + @JsonProperty(value = "automated") + private Boolean automated; + + /* + * Optional link to remediate in Azure Portal. + */ + @JsonProperty(value = "portalLink") + private String portalLink; + + /** + * Get the description property: Remediation description. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: Remediation description. + * + * @param description the description value to set. + * @return the Remediation object itself. + */ + public Remediation withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the scripts property: Remediation script. + * + * @return the scripts value. + */ + public List scripts() { + return this.scripts; + } + + /** + * Set the scripts property: Remediation script. + * + * @param scripts the scripts value to set. + * @return the Remediation object itself. + */ + public Remediation withScripts(List scripts) { + this.scripts = scripts; + return this; + } + + /** + * Get the automated property: Is remediation automated. + * + * @return the automated value. + */ + public Boolean automated() { + return this.automated; + } + + /** + * Set the automated property: Is remediation automated. + * + * @param automated the automated value to set. + * @return the Remediation object itself. + */ + public Remediation withAutomated(Boolean automated) { + this.automated = automated; + return this; + } + + /** + * Get the portalLink property: Optional link to remediate in Azure Portal. + * + * @return the portalLink value. + */ + public String portalLink() { + return this.portalLink; + } + + /** + * Set the portalLink property: Optional link to remediate in Azure Portal. + * + * @param portalLink the portalLink value to set. + * @return the Remediation object itself. + */ + public Remediation withPortalLink(String portalLink) { + this.portalLink = portalLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ReportedSeverity.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ReportedSeverity.java new file mode 100644 index 000000000000..4f20af550468 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ReportedSeverity.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ReportedSeverity. */ +public final class ReportedSeverity extends ExpandableStringEnum { + /** Static value Informational for ReportedSeverity. */ + public static final ReportedSeverity INFORMATIONAL = fromString("Informational"); + + /** Static value Low for ReportedSeverity. */ + public static final ReportedSeverity LOW = fromString("Low"); + + /** Static value Medium for ReportedSeverity. */ + public static final ReportedSeverity MEDIUM = fromString("Medium"); + + /** Static value High for ReportedSeverity. */ + public static final ReportedSeverity HIGH = fromString("High"); + + /** + * Creates or finds a ReportedSeverity from its string representation. + * + * @param name a name to look for. + * @return the corresponding ReportedSeverity. + */ + @JsonCreator + public static ReportedSeverity fromString(String name) { + return fromString(name, ReportedSeverity.class); + } + + /** @return known ReportedSeverity values. */ + public static Collection values() { + return values(ReportedSeverity.class); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ResetPasswordInput.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ResetPasswordInput.java new file mode 100644 index 000000000000..f2cab92fffb6 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ResetPasswordInput.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Reset password input. */ +@Fluent +public final class ResetPasswordInput { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResetPasswordInput.class); + + /* + * The appliance id of the sensor. + */ + @JsonProperty(value = "applianceId") + private String applianceId; + + /** + * Get the applianceId property: The appliance id of the sensor. + * + * @return the applianceId value. + */ + public String applianceId() { + return this.applianceId; + } + + /** + * Set the applianceId property: The appliance id of the sensor. + * + * @param applianceId the applianceId value to set. + * @return the ResetPasswordInput object itself. + */ + public ResetPasswordInput withApplianceId(String applianceId) { + this.applianceId = applianceId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ResourceDetails.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ResourceDetails.java new file mode 100644 index 000000000000..c3c21382e212 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ResourceDetails.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** Details of the resource that was assessed. */ +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "source", + defaultImpl = ResourceDetails.class) +@JsonTypeName("ResourceDetails") +@JsonSubTypes({ + @JsonSubTypes.Type(name = "Azure", value = AzureResourceDetails.class), + @JsonSubTypes.Type(name = "OnPremise", value = OnPremiseResourceDetails.class) +}) +@Immutable +public class ResourceDetails { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceDetails.class); + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ResourceIdentifier.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ResourceIdentifier.java new file mode 100644 index 000000000000..d7ae234e3c22 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ResourceIdentifier.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * A resource identifier for an alert which can be used to direct the alert to the right product exposure group (tenant, + * workspace, subscription etc.). + */ +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "type", + defaultImpl = ResourceIdentifier.class) +@JsonTypeName("ResourceIdentifier") +@JsonSubTypes({ + @JsonSubTypes.Type(name = "AzureResource", value = AzureResourceIdentifier.class), + @JsonSubTypes.Type(name = "LogAnalytics", value = LogAnalyticsIdentifier.class) +}) +@Immutable +public class ResourceIdentifier { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceIdentifier.class); + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ResourceIdentifierType.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ResourceIdentifierType.java new file mode 100644 index 000000000000..631d172d04e4 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ResourceIdentifierType.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ResourceIdentifierType. */ +public final class ResourceIdentifierType extends ExpandableStringEnum { + /** Static value AzureResource for ResourceIdentifierType. */ + public static final ResourceIdentifierType AZURE_RESOURCE = fromString("AzureResource"); + + /** Static value LogAnalytics for ResourceIdentifierType. */ + public static final ResourceIdentifierType LOG_ANALYTICS = fromString("LogAnalytics"); + + /** + * Creates or finds a ResourceIdentifierType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ResourceIdentifierType. + */ + @JsonCreator + public static ResourceIdentifierType fromString(String name) { + return fromString(name, ResourceIdentifierType.class); + } + + /** @return known ResourceIdentifierType values. */ + public static Collection values() { + return values(ResourceIdentifierType.class); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ResourceStatus.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ResourceStatus.java new file mode 100644 index 000000000000..b0262e4c79f5 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ResourceStatus.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ResourceStatus. */ +public final class ResourceStatus extends ExpandableStringEnum { + /** Static value Healthy for ResourceStatus. */ + public static final ResourceStatus HEALTHY = fromString("Healthy"); + + /** Static value NotApplicable for ResourceStatus. */ + public static final ResourceStatus NOT_APPLICABLE = fromString("NotApplicable"); + + /** Static value OffByPolicy for ResourceStatus. */ + public static final ResourceStatus OFF_BY_POLICY = fromString("OffByPolicy"); + + /** Static value NotHealthy for ResourceStatus. */ + public static final ResourceStatus NOT_HEALTHY = fromString("NotHealthy"); + + /** + * Creates or finds a ResourceStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding ResourceStatus. + */ + @JsonCreator + public static ResourceStatus fromString(String name) { + return fromString(name, ResourceStatus.class); + } + + /** @return known ResourceStatus values. */ + public static Collection values() { + return values(ResourceStatus.class); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Rule.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Rule.java new file mode 100644 index 000000000000..ef920c2f5c2c --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Rule.java @@ -0,0 +1,161 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * Describes remote addresses that is recommended to communicate with the Azure resource on some (Protocol, Port, + * Direction). All other remote addresses are recommended to be blocked. + */ +@Fluent +public final class Rule { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Rule.class); + + /* + * The name of the rule + */ + @JsonProperty(value = "name") + private String name; + + /* + * The rule's direction + */ + @JsonProperty(value = "direction") + private Direction direction; + + /* + * The rule's destination port + */ + @JsonProperty(value = "destinationPort") + private Integer destinationPort; + + /* + * The rule's transport protocols + */ + @JsonProperty(value = "protocols") + private List protocols; + + /* + * The remote IP addresses that should be able to communicate with the + * Azure resource on the rule's destination port and protocol + */ + @JsonProperty(value = "ipAddresses") + private List ipAddresses; + + /** + * Get the name property: The name of the rule. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the rule. + * + * @param name the name value to set. + * @return the Rule object itself. + */ + public Rule withName(String name) { + this.name = name; + return this; + } + + /** + * Get the direction property: The rule's direction. + * + * @return the direction value. + */ + public Direction direction() { + return this.direction; + } + + /** + * Set the direction property: The rule's direction. + * + * @param direction the direction value to set. + * @return the Rule object itself. + */ + public Rule withDirection(Direction direction) { + this.direction = direction; + return this; + } + + /** + * Get the destinationPort property: The rule's destination port. + * + * @return the destinationPort value. + */ + public Integer destinationPort() { + return this.destinationPort; + } + + /** + * Set the destinationPort property: The rule's destination port. + * + * @param destinationPort the destinationPort value to set. + * @return the Rule object itself. + */ + public Rule withDestinationPort(Integer destinationPort) { + this.destinationPort = destinationPort; + return this; + } + + /** + * Get the protocols property: The rule's transport protocols. + * + * @return the protocols value. + */ + public List protocols() { + return this.protocols; + } + + /** + * Set the protocols property: The rule's transport protocols. + * + * @param protocols the protocols value to set. + * @return the Rule object itself. + */ + public Rule withProtocols(List protocols) { + this.protocols = protocols; + return this; + } + + /** + * Get the ipAddresses property: The remote IP addresses that should be able to communicate with the Azure resource + * on the rule's destination port and protocol. + * + * @return the ipAddresses value. + */ + public List ipAddresses() { + return this.ipAddresses; + } + + /** + * Set the ipAddresses property: The remote IP addresses that should be able to communicate with the Azure resource + * on the rule's destination port and protocol. + * + * @param ipAddresses the ipAddresses value to set. + * @return the Rule object itself. + */ + public Rule withIpAddresses(List ipAddresses) { + this.ipAddresses = ipAddresses; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/RuleResults.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/RuleResults.java new file mode 100644 index 000000000000..68af6ea8d61f --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/RuleResults.java @@ -0,0 +1,179 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.RuleResultsInner; +import java.util.List; + +/** An immutable client-side representation of RuleResults. */ +public interface RuleResults { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the properties property: Rule results properties. + * + * @return the properties value. + */ + RuleResultsProperties properties(); + + /** + * Gets the inner com.azure.resourcemanager.security.fluent.models.RuleResultsInner object. + * + * @return the inner object. + */ + RuleResultsInner innerModel(); + + /** The entirety of the RuleResults definition. */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithScope, DefinitionStages.WithCreate { + } + /** The RuleResults definition stages. */ + interface DefinitionStages { + /** The first stage of the RuleResults definition. */ + interface Blank extends WithScope { + } + /** The stage of the RuleResults definition allowing to specify parent resource. */ + interface WithScope { + /** + * Specifies resourceId. + * + * @param resourceId The identifier of the resource. + * @return the next definition stage. + */ + WithCreate withExistingResourceId(String resourceId); + } + /** + * The stage of the RuleResults definition which contains all the minimum required properties for the resource + * to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithLatestScan, DefinitionStages.WithResults, DefinitionStages.WithWorkspaceId { + /** + * Executes the create request. + * + * @return the created resource. + */ + RuleResults create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + RuleResults create(Context context); + } + /** The stage of the RuleResults definition allowing to specify latestScan. */ + interface WithLatestScan { + /** + * Specifies the latestScan property: Take results from latest scan.. + * + * @param latestScan Take results from latest scan. + * @return the next definition stage. + */ + WithCreate withLatestScan(Boolean latestScan); + } + /** The stage of the RuleResults definition allowing to specify results. */ + interface WithResults { + /** + * Specifies the results property: Expected results to be inserted into the baseline. Leave this field empty + * it LatestScan == true.. + * + * @param results Expected results to be inserted into the baseline. Leave this field empty it LatestScan == + * true. + * @return the next definition stage. + */ + WithCreate withResults(List> results); + } + /** The stage of the RuleResults definition allowing to specify workspaceId. */ + interface WithWorkspaceId { + /** + * Specifies the workspaceId property: The workspace Id.. + * + * @param workspaceId The workspace Id. + * @return the next definition stage. + */ + WithCreate withWorkspaceId(String workspaceId); + } + } + /** + * Begins update for the RuleResults resource. + * + * @return the stage of resource update. + */ + RuleResults.Update update(); + + /** The template for RuleResults update. */ + interface Update extends UpdateStages.WithLatestScan, UpdateStages.WithResults, UpdateStages.WithWorkspaceId { + /** + * Executes the update request. + * + * @return the updated resource. + */ + RuleResults apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + RuleResults apply(Context context); + } + /** The RuleResults update stages. */ + interface UpdateStages { + /** The stage of the RuleResults update allowing to specify latestScan. */ + interface WithLatestScan { + /** + * Specifies the latestScan property: Take results from latest scan.. + * + * @param latestScan Take results from latest scan. + * @return the next definition stage. + */ + Update withLatestScan(Boolean latestScan); + } + /** The stage of the RuleResults update allowing to specify results. */ + interface WithResults { + /** + * Specifies the results property: Expected results to be inserted into the baseline. Leave this field empty + * it LatestScan == true.. + * + * @param results Expected results to be inserted into the baseline. Leave this field empty it LatestScan == + * true. + * @return the next definition stage. + */ + Update withResults(List> results); + } + /** The stage of the RuleResults update allowing to specify workspaceId. */ + interface WithWorkspaceId { + /** + * Specifies the workspaceId property: The workspace Id.. + * + * @param workspaceId The workspace Id. + * @return the next definition stage. + */ + Update withWorkspaceId(String workspaceId); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/RuleResultsInput.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/RuleResultsInput.java new file mode 100644 index 000000000000..a3eaf9b73c7e --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/RuleResultsInput.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Rule results input. */ +@Fluent +public final class RuleResultsInput { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RuleResultsInput.class); + + /* + * Take results from latest scan. + */ + @JsonProperty(value = "latestScan") + private Boolean latestScan; + + /* + * Expected results to be inserted into the baseline. + * Leave this field empty it LatestScan == true. + */ + @JsonProperty(value = "results") + private List> results; + + /** + * Get the latestScan property: Take results from latest scan. + * + * @return the latestScan value. + */ + public Boolean latestScan() { + return this.latestScan; + } + + /** + * Set the latestScan property: Take results from latest scan. + * + * @param latestScan the latestScan value to set. + * @return the RuleResultsInput object itself. + */ + public RuleResultsInput withLatestScan(Boolean latestScan) { + this.latestScan = latestScan; + return this; + } + + /** + * Get the results property: Expected results to be inserted into the baseline. Leave this field empty it LatestScan + * == true. + * + * @return the results value. + */ + public List> results() { + return this.results; + } + + /** + * Set the results property: Expected results to be inserted into the baseline. Leave this field empty it LatestScan + * == true. + * + * @param results the results value to set. + * @return the RuleResultsInput object itself. + */ + public RuleResultsInput withResults(List> results) { + this.results = results; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/RuleResultsProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/RuleResultsProperties.java new file mode 100644 index 000000000000..2a5faf6303e1 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/RuleResultsProperties.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Rule results properties. */ +@Fluent +public final class RuleResultsProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RuleResultsProperties.class); + + /* + * Expected results in the baseline. + */ + @JsonProperty(value = "results") + private List> results; + + /** + * Get the results property: Expected results in the baseline. + * + * @return the results value. + */ + public List> results() { + return this.results; + } + + /** + * Set the results property: Expected results in the baseline. + * + * @param results the results value to set. + * @return the RuleResultsProperties object itself. + */ + public RuleResultsProperties withResults(List> results) { + this.results = results; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/RuleSeverity.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/RuleSeverity.java new file mode 100644 index 000000000000..dbb1b3ad686f --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/RuleSeverity.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for RuleSeverity. */ +public final class RuleSeverity extends ExpandableStringEnum { + /** Static value High for RuleSeverity. */ + public static final RuleSeverity HIGH = fromString("High"); + + /** Static value Medium for RuleSeverity. */ + public static final RuleSeverity MEDIUM = fromString("Medium"); + + /** Static value Low for RuleSeverity. */ + public static final RuleSeverity LOW = fromString("Low"); + + /** Static value Informational for RuleSeverity. */ + public static final RuleSeverity INFORMATIONAL = fromString("Informational"); + + /** Static value Obsolete for RuleSeverity. */ + public static final RuleSeverity OBSOLETE = fromString("Obsolete"); + + /** + * Creates or finds a RuleSeverity from its string representation. + * + * @param name a name to look for. + * @return the corresponding RuleSeverity. + */ + @JsonCreator + public static RuleSeverity fromString(String name) { + return fromString(name, RuleSeverity.class); + } + + /** @return known RuleSeverity values. */ + public static Collection values() { + return values(RuleSeverity.class); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/RuleState.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/RuleState.java new file mode 100644 index 000000000000..ea01697bcfe0 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/RuleState.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for RuleState. */ +public enum RuleState { + /** Enum value Enabled. */ + ENABLED("Enabled"), + + /** Enum value Disabled. */ + DISABLED("Disabled"), + + /** Enum value Expired. */ + EXPIRED("Expired"); + + /** The actual serialized value for a RuleState instance. */ + private final String value; + + RuleState(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a RuleState instance. + * + * @param value the serialized value to parse. + * @return the parsed RuleState object, or null if unable to parse. + */ + @JsonCreator + public static RuleState fromString(String value) { + RuleState[] items = RuleState.values(); + for (RuleState item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/RuleStatus.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/RuleStatus.java new file mode 100644 index 000000000000..a2405d5c198e --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/RuleStatus.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for RuleStatus. */ +public final class RuleStatus extends ExpandableStringEnum { + /** Static value NonFinding for RuleStatus. */ + public static final RuleStatus NON_FINDING = fromString("NonFinding"); + + /** Static value Finding for RuleStatus. */ + public static final RuleStatus FINDING = fromString("Finding"); + + /** Static value InternalError for RuleStatus. */ + public static final RuleStatus INTERNAL_ERROR = fromString("InternalError"); + + /** + * Creates or finds a RuleStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding RuleStatus. + */ + @JsonCreator + public static RuleStatus fromString(String name) { + return fromString(name, RuleStatus.class); + } + + /** @return known RuleStatus values. */ + public static Collection values() { + return values(RuleStatus.class); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/RuleType.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/RuleType.java new file mode 100644 index 000000000000..f7baaea29576 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/RuleType.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for RuleType. */ +public final class RuleType extends ExpandableStringEnum { + /** Static value Binary for RuleType. */ + public static final RuleType BINARY = fromString("Binary"); + + /** Static value BaselineExpected for RuleType. */ + public static final RuleType BASELINE_EXPECTED = fromString("BaselineExpected"); + + /** Static value PositiveList for RuleType. */ + public static final RuleType POSITIVE_LIST = fromString("PositiveList"); + + /** Static value NegativeList for RuleType. */ + public static final RuleType NEGATIVE_LIST = fromString("NegativeList"); + + /** + * Creates or finds a RuleType from its string representation. + * + * @param name a name to look for. + * @return the corresponding RuleType. + */ + @JsonCreator + public static RuleType fromString(String name) { + return fromString(name, RuleType.class); + } + + /** @return known RuleType values. */ + public static Collection values() { + return values(RuleType.class); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/RulesResults.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/RulesResults.java new file mode 100644 index 000000000000..9d688c59de5e --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/RulesResults.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.resourcemanager.security.fluent.models.RulesResultsInner; +import java.util.List; + +/** An immutable client-side representation of RulesResults. */ +public interface RulesResults { + /** + * Gets the value property: List of rule results. + * + * @return the value value. + */ + List value(); + + /** + * Gets the inner com.azure.resourcemanager.security.fluent.models.RulesResultsInner object. + * + * @return the inner object. + */ + RulesResultsInner innerModel(); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/RulesResultsInput.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/RulesResultsInput.java new file mode 100644 index 000000000000..d147f9e7e6bb --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/RulesResultsInput.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** Rules results input. */ +@Fluent +public final class RulesResultsInput { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RulesResultsInput.class); + + /* + * Take results from latest scan. + */ + @JsonProperty(value = "latestScan") + private Boolean latestScan; + + /* + * Expected results to be inserted into the baseline. + * Leave this field empty it LatestScan == true. + */ + @JsonProperty(value = "results") + private Map>> results; + + /** + * Get the latestScan property: Take results from latest scan. + * + * @return the latestScan value. + */ + public Boolean latestScan() { + return this.latestScan; + } + + /** + * Set the latestScan property: Take results from latest scan. + * + * @param latestScan the latestScan value to set. + * @return the RulesResultsInput object itself. + */ + public RulesResultsInput withLatestScan(Boolean latestScan) { + this.latestScan = latestScan; + return this; + } + + /** + * Get the results property: Expected results to be inserted into the baseline. Leave this field empty it LatestScan + * == true. + * + * @return the results value. + */ + public Map>> results() { + return this.results; + } + + /** + * Set the results property: Expected results to be inserted into the baseline. Leave this field empty it LatestScan + * == true. + * + * @param results the results value to set. + * @return the RulesResultsInput object itself. + */ + public RulesResultsInput withResults(Map>> results) { + this.results = results; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Scan.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Scan.java new file mode 100644 index 000000000000..824646abb620 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Scan.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.resourcemanager.security.fluent.models.ScanInner; + +/** An immutable client-side representation of Scan. */ +public interface Scan { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the properties property: A vulnerability assessment scan record properties. + * + * @return the properties value. + */ + ScanProperties properties(); + + /** + * Gets the inner com.azure.resourcemanager.security.fluent.models.ScanInner object. + * + * @return the inner object. + */ + ScanInner innerModel(); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ScanProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ScanProperties.java new file mode 100644 index 000000000000..f63f237a3011 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ScanProperties.java @@ -0,0 +1,389 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** A vulnerability assessment scan record properties. */ +@Fluent +public final class ScanProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ScanProperties.class); + + /* + * The scan trigger type. + */ + @JsonProperty(value = "triggerType") + private ScanTriggerType triggerType; + + /* + * The scan status. + */ + @JsonProperty(value = "state") + private ScanState state; + + /* + * The server name. + */ + @JsonProperty(value = "server") + private String server; + + /* + * The database name. + */ + @JsonProperty(value = "database") + private String database; + + /* + * The SQL version. + */ + @JsonProperty(value = "sqlVersion") + private String sqlVersion; + + /* + * The scan start time (UTC). + */ + @JsonProperty(value = "startTime") + private OffsetDateTime startTime; + + /* + * Scan results are valid until end time (UTC). + */ + @JsonProperty(value = "endTime") + private OffsetDateTime endTime; + + /* + * The number of failed rules with high severity. + */ + @JsonProperty(value = "highSeverityFailedRulesCount") + private Integer highSeverityFailedRulesCount; + + /* + * The number of failed rules with medium severity. + */ + @JsonProperty(value = "mediumSeverityFailedRulesCount") + private Integer mediumSeverityFailedRulesCount; + + /* + * The number of failed rules with low severity. + */ + @JsonProperty(value = "lowSeverityFailedRulesCount") + private Integer lowSeverityFailedRulesCount; + + /* + * The number of total passed rules. + */ + @JsonProperty(value = "totalPassedRulesCount") + private Integer totalPassedRulesCount; + + /* + * The number of total failed rules. + */ + @JsonProperty(value = "totalFailedRulesCount") + private Integer totalFailedRulesCount; + + /* + * The number of total rules assessed. + */ + @JsonProperty(value = "totalRulesCount") + private Integer totalRulesCount; + + /* + * Baseline created for this database, and has one or more rules. + */ + @JsonProperty(value = "isBaselineApplied") + private Boolean isBaselineApplied; + + /** + * Get the triggerType property: The scan trigger type. + * + * @return the triggerType value. + */ + public ScanTriggerType triggerType() { + return this.triggerType; + } + + /** + * Set the triggerType property: The scan trigger type. + * + * @param triggerType the triggerType value to set. + * @return the ScanProperties object itself. + */ + public ScanProperties withTriggerType(ScanTriggerType triggerType) { + this.triggerType = triggerType; + return this; + } + + /** + * Get the state property: The scan status. + * + * @return the state value. + */ + public ScanState state() { + return this.state; + } + + /** + * Set the state property: The scan status. + * + * @param state the state value to set. + * @return the ScanProperties object itself. + */ + public ScanProperties withState(ScanState state) { + this.state = state; + return this; + } + + /** + * Get the server property: The server name. + * + * @return the server value. + */ + public String server() { + return this.server; + } + + /** + * Set the server property: The server name. + * + * @param server the server value to set. + * @return the ScanProperties object itself. + */ + public ScanProperties withServer(String server) { + this.server = server; + return this; + } + + /** + * Get the database property: The database name. + * + * @return the database value. + */ + public String database() { + return this.database; + } + + /** + * Set the database property: The database name. + * + * @param database the database value to set. + * @return the ScanProperties object itself. + */ + public ScanProperties withDatabase(String database) { + this.database = database; + return this; + } + + /** + * Get the sqlVersion property: The SQL version. + * + * @return the sqlVersion value. + */ + public String sqlVersion() { + return this.sqlVersion; + } + + /** + * Set the sqlVersion property: The SQL version. + * + * @param sqlVersion the sqlVersion value to set. + * @return the ScanProperties object itself. + */ + public ScanProperties withSqlVersion(String sqlVersion) { + this.sqlVersion = sqlVersion; + return this; + } + + /** + * Get the startTime property: The scan start time (UTC). + * + * @return the startTime value. + */ + public OffsetDateTime startTime() { + return this.startTime; + } + + /** + * Set the startTime property: The scan start time (UTC). + * + * @param startTime the startTime value to set. + * @return the ScanProperties object itself. + */ + public ScanProperties withStartTime(OffsetDateTime startTime) { + this.startTime = startTime; + return this; + } + + /** + * Get the endTime property: Scan results are valid until end time (UTC). + * + * @return the endTime value. + */ + public OffsetDateTime endTime() { + return this.endTime; + } + + /** + * Set the endTime property: Scan results are valid until end time (UTC). + * + * @param endTime the endTime value to set. + * @return the ScanProperties object itself. + */ + public ScanProperties withEndTime(OffsetDateTime endTime) { + this.endTime = endTime; + return this; + } + + /** + * Get the highSeverityFailedRulesCount property: The number of failed rules with high severity. + * + * @return the highSeverityFailedRulesCount value. + */ + public Integer highSeverityFailedRulesCount() { + return this.highSeverityFailedRulesCount; + } + + /** + * Set the highSeverityFailedRulesCount property: The number of failed rules with high severity. + * + * @param highSeverityFailedRulesCount the highSeverityFailedRulesCount value to set. + * @return the ScanProperties object itself. + */ + public ScanProperties withHighSeverityFailedRulesCount(Integer highSeverityFailedRulesCount) { + this.highSeverityFailedRulesCount = highSeverityFailedRulesCount; + return this; + } + + /** + * Get the mediumSeverityFailedRulesCount property: The number of failed rules with medium severity. + * + * @return the mediumSeverityFailedRulesCount value. + */ + public Integer mediumSeverityFailedRulesCount() { + return this.mediumSeverityFailedRulesCount; + } + + /** + * Set the mediumSeverityFailedRulesCount property: The number of failed rules with medium severity. + * + * @param mediumSeverityFailedRulesCount the mediumSeverityFailedRulesCount value to set. + * @return the ScanProperties object itself. + */ + public ScanProperties withMediumSeverityFailedRulesCount(Integer mediumSeverityFailedRulesCount) { + this.mediumSeverityFailedRulesCount = mediumSeverityFailedRulesCount; + return this; + } + + /** + * Get the lowSeverityFailedRulesCount property: The number of failed rules with low severity. + * + * @return the lowSeverityFailedRulesCount value. + */ + public Integer lowSeverityFailedRulesCount() { + return this.lowSeverityFailedRulesCount; + } + + /** + * Set the lowSeverityFailedRulesCount property: The number of failed rules with low severity. + * + * @param lowSeverityFailedRulesCount the lowSeverityFailedRulesCount value to set. + * @return the ScanProperties object itself. + */ + public ScanProperties withLowSeverityFailedRulesCount(Integer lowSeverityFailedRulesCount) { + this.lowSeverityFailedRulesCount = lowSeverityFailedRulesCount; + return this; + } + + /** + * Get the totalPassedRulesCount property: The number of total passed rules. + * + * @return the totalPassedRulesCount value. + */ + public Integer totalPassedRulesCount() { + return this.totalPassedRulesCount; + } + + /** + * Set the totalPassedRulesCount property: The number of total passed rules. + * + * @param totalPassedRulesCount the totalPassedRulesCount value to set. + * @return the ScanProperties object itself. + */ + public ScanProperties withTotalPassedRulesCount(Integer totalPassedRulesCount) { + this.totalPassedRulesCount = totalPassedRulesCount; + return this; + } + + /** + * Get the totalFailedRulesCount property: The number of total failed rules. + * + * @return the totalFailedRulesCount value. + */ + public Integer totalFailedRulesCount() { + return this.totalFailedRulesCount; + } + + /** + * Set the totalFailedRulesCount property: The number of total failed rules. + * + * @param totalFailedRulesCount the totalFailedRulesCount value to set. + * @return the ScanProperties object itself. + */ + public ScanProperties withTotalFailedRulesCount(Integer totalFailedRulesCount) { + this.totalFailedRulesCount = totalFailedRulesCount; + return this; + } + + /** + * Get the totalRulesCount property: The number of total rules assessed. + * + * @return the totalRulesCount value. + */ + public Integer totalRulesCount() { + return this.totalRulesCount; + } + + /** + * Set the totalRulesCount property: The number of total rules assessed. + * + * @param totalRulesCount the totalRulesCount value to set. + * @return the ScanProperties object itself. + */ + public ScanProperties withTotalRulesCount(Integer totalRulesCount) { + this.totalRulesCount = totalRulesCount; + return this; + } + + /** + * Get the isBaselineApplied property: Baseline created for this database, and has one or more rules. + * + * @return the isBaselineApplied value. + */ + public Boolean isBaselineApplied() { + return this.isBaselineApplied; + } + + /** + * Set the isBaselineApplied property: Baseline created for this database, and has one or more rules. + * + * @param isBaselineApplied the isBaselineApplied value to set. + * @return the ScanProperties object itself. + */ + public ScanProperties withIsBaselineApplied(Boolean isBaselineApplied) { + this.isBaselineApplied = isBaselineApplied; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ScanResult.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ScanResult.java new file mode 100644 index 000000000000..30a10622825c --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ScanResult.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.resourcemanager.security.fluent.models.ScanResultInner; + +/** An immutable client-side representation of ScanResult. */ +public interface ScanResult { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the properties property: A vulnerability assessment scan result properties for a single rule. + * + * @return the properties value. + */ + ScanResultProperties properties(); + + /** + * Gets the inner com.azure.resourcemanager.security.fluent.models.ScanResultInner object. + * + * @return the inner object. + */ + ScanResultInner innerModel(); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ScanResultProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ScanResultProperties.java new file mode 100644 index 000000000000..4c89e67e490a --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ScanResultProperties.java @@ -0,0 +1,216 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A vulnerability assessment scan result properties for a single rule. */ +@Fluent +public final class ScanResultProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ScanResultProperties.class); + + /* + * The rule Id. + */ + @JsonProperty(value = "ruleId") + private String ruleId; + + /* + * The rule result status. + */ + @JsonProperty(value = "status") + private RuleStatus status; + + /* + * Indicated whether the results specified here are trimmed. + */ + @JsonProperty(value = "isTrimmed") + private Boolean isTrimmed; + + /* + * The results of the query that was run. + */ + @JsonProperty(value = "queryResults") + private List> queryResults; + + /* + * Remediation details. + */ + @JsonProperty(value = "remediation") + private Remediation remediation; + + /* + * The rule result adjusted with baseline. + */ + @JsonProperty(value = "baselineAdjustedResult") + private BaselineAdjustedResult baselineAdjustedResult; + + /* + * vulnerability assessment rule metadata details. + */ + @JsonProperty(value = "ruleMetadata") + private VaRule ruleMetadata; + + /** + * Get the ruleId property: The rule Id. + * + * @return the ruleId value. + */ + public String ruleId() { + return this.ruleId; + } + + /** + * Set the ruleId property: The rule Id. + * + * @param ruleId the ruleId value to set. + * @return the ScanResultProperties object itself. + */ + public ScanResultProperties withRuleId(String ruleId) { + this.ruleId = ruleId; + return this; + } + + /** + * Get the status property: The rule result status. + * + * @return the status value. + */ + public RuleStatus status() { + return this.status; + } + + /** + * Set the status property: The rule result status. + * + * @param status the status value to set. + * @return the ScanResultProperties object itself. + */ + public ScanResultProperties withStatus(RuleStatus status) { + this.status = status; + return this; + } + + /** + * Get the isTrimmed property: Indicated whether the results specified here are trimmed. + * + * @return the isTrimmed value. + */ + public Boolean isTrimmed() { + return this.isTrimmed; + } + + /** + * Set the isTrimmed property: Indicated whether the results specified here are trimmed. + * + * @param isTrimmed the isTrimmed value to set. + * @return the ScanResultProperties object itself. + */ + public ScanResultProperties withIsTrimmed(Boolean isTrimmed) { + this.isTrimmed = isTrimmed; + return this; + } + + /** + * Get the queryResults property: The results of the query that was run. + * + * @return the queryResults value. + */ + public List> queryResults() { + return this.queryResults; + } + + /** + * Set the queryResults property: The results of the query that was run. + * + * @param queryResults the queryResults value to set. + * @return the ScanResultProperties object itself. + */ + public ScanResultProperties withQueryResults(List> queryResults) { + this.queryResults = queryResults; + return this; + } + + /** + * Get the remediation property: Remediation details. + * + * @return the remediation value. + */ + public Remediation remediation() { + return this.remediation; + } + + /** + * Set the remediation property: Remediation details. + * + * @param remediation the remediation value to set. + * @return the ScanResultProperties object itself. + */ + public ScanResultProperties withRemediation(Remediation remediation) { + this.remediation = remediation; + return this; + } + + /** + * Get the baselineAdjustedResult property: The rule result adjusted with baseline. + * + * @return the baselineAdjustedResult value. + */ + public BaselineAdjustedResult baselineAdjustedResult() { + return this.baselineAdjustedResult; + } + + /** + * Set the baselineAdjustedResult property: The rule result adjusted with baseline. + * + * @param baselineAdjustedResult the baselineAdjustedResult value to set. + * @return the ScanResultProperties object itself. + */ + public ScanResultProperties withBaselineAdjustedResult(BaselineAdjustedResult baselineAdjustedResult) { + this.baselineAdjustedResult = baselineAdjustedResult; + return this; + } + + /** + * Get the ruleMetadata property: vulnerability assessment rule metadata details. + * + * @return the ruleMetadata value. + */ + public VaRule ruleMetadata() { + return this.ruleMetadata; + } + + /** + * Set the ruleMetadata property: vulnerability assessment rule metadata details. + * + * @param ruleMetadata the ruleMetadata value to set. + * @return the ScanResultProperties object itself. + */ + public ScanResultProperties withRuleMetadata(VaRule ruleMetadata) { + this.ruleMetadata = ruleMetadata; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (remediation() != null) { + remediation().validate(); + } + if (baselineAdjustedResult() != null) { + baselineAdjustedResult().validate(); + } + if (ruleMetadata() != null) { + ruleMetadata().validate(); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ScanResults.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ScanResults.java new file mode 100644 index 000000000000..babe43af9aab --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ScanResults.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.resourcemanager.security.fluent.models.ScanResultsInner; +import java.util.List; + +/** An immutable client-side representation of ScanResults. */ +public interface ScanResults { + /** + * Gets the value property: List of vulnerability assessment scan results. + * + * @return the value value. + */ + List value(); + + /** + * Gets the inner com.azure.resourcemanager.security.fluent.models.ScanResultsInner object. + * + * @return the inner object. + */ + ScanResultsInner innerModel(); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ScanState.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ScanState.java new file mode 100644 index 000000000000..08625fb06ab1 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ScanState.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ScanState. */ +public final class ScanState extends ExpandableStringEnum { + /** Static value Failed for ScanState. */ + public static final ScanState FAILED = fromString("Failed"); + + /** Static value FailedToRun for ScanState. */ + public static final ScanState FAILED_TO_RUN = fromString("FailedToRun"); + + /** Static value InProgress for ScanState. */ + public static final ScanState IN_PROGRESS = fromString("InProgress"); + + /** Static value Passed for ScanState. */ + public static final ScanState PASSED = fromString("Passed"); + + /** + * Creates or finds a ScanState from its string representation. + * + * @param name a name to look for. + * @return the corresponding ScanState. + */ + @JsonCreator + public static ScanState fromString(String name) { + return fromString(name, ScanState.class); + } + + /** @return known ScanState values. */ + public static Collection values() { + return values(ScanState.class); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ScanTriggerType.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ScanTriggerType.java new file mode 100644 index 000000000000..c33de57c4b7e --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ScanTriggerType.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ScanTriggerType. */ +public final class ScanTriggerType extends ExpandableStringEnum { + /** Static value OnDemand for ScanTriggerType. */ + public static final ScanTriggerType ON_DEMAND = fromString("OnDemand"); + + /** Static value Recurring for ScanTriggerType. */ + public static final ScanTriggerType RECURRING = fromString("Recurring"); + + /** + * Creates or finds a ScanTriggerType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ScanTriggerType. + */ + @JsonCreator + public static ScanTriggerType fromString(String name) { + return fromString(name, ScanTriggerType.class); + } + + /** @return known ScanTriggerType values. */ + public static Collection values() { + return values(ScanTriggerType.class); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ScanningFunctionality.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ScanningFunctionality.java new file mode 100644 index 000000000000..ffbca2bb1750 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ScanningFunctionality.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ScanningFunctionality. */ +public final class ScanningFunctionality extends ExpandableStringEnum { + /** Static value ScannerDevice for ScanningFunctionality. */ + public static final ScanningFunctionality SCANNER_DEVICE = fromString("ScannerDevice"); + + /** Static value NotScannerDevice for ScanningFunctionality. */ + public static final ScanningFunctionality NOT_SCANNER_DEVICE = fromString("NotScannerDevice"); + + /** + * Creates or finds a ScanningFunctionality from its string representation. + * + * @param name a name to look for. + * @return the corresponding ScanningFunctionality. + */ + @JsonCreator + public static ScanningFunctionality fromString(String name) { + return fromString(name, ScanningFunctionality.class); + } + + /** @return known ScanningFunctionality values. */ + public static Collection values() { + return values(ScanningFunctionality.class); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Scans.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Scans.java new file mode 100644 index 000000000000..ab7530dc4d29 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Scans.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.resourcemanager.security.fluent.models.ScansInner; +import java.util.List; + +/** An immutable client-side representation of Scans. */ +public interface Scans { + /** + * Gets the value property: List of vulnerability assessment scan records. + * + * @return the value value. + */ + List value(); + + /** + * Gets the inner com.azure.resourcemanager.security.fluent.models.ScansInner object. + * + * @return the inner object. + */ + ScansInner innerModel(); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ScopeElement.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ScopeElement.java new file mode 100644 index 000000000000..0a6beeebf36c --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ScopeElement.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.HashMap; +import java.util.Map; + +/** A more specific scope used to identify the alerts to suppress. */ +@Fluent +public final class ScopeElement { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ScopeElement.class); + + /* + * The alert entity type to suppress by. + */ + @JsonProperty(value = "field") + private String field; + + /* + * A more specific scope used to identify the alerts to suppress. + */ + @JsonIgnore private Map additionalProperties; + + /** + * Get the field property: The alert entity type to suppress by. + * + * @return the field value. + */ + public String field() { + return this.field; + } + + /** + * Set the field property: The alert entity type to suppress by. + * + * @param field the field value to set. + * @return the ScopeElement object itself. + */ + public ScopeElement withField(String field) { + this.field = field; + return this; + } + + /** + * Get the additionalProperties property: A more specific scope used to identify the alerts to suppress. + * + * @return the additionalProperties value. + */ + @JsonAnyGetter + public Map additionalProperties() { + return this.additionalProperties; + } + + /** + * Set the additionalProperties property: A more specific scope used to identify the alerts to suppress. + * + * @param additionalProperties the additionalProperties value to set. + * @return the ScopeElement object itself. + */ + public ScopeElement withAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + @JsonAnySetter + void withAdditionalProperties(String key, Object value) { + if (additionalProperties == null) { + additionalProperties = new HashMap<>(); + } + additionalProperties.put(key, value); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecureScoreControlDefinitionItem.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecureScoreControlDefinitionItem.java new file mode 100644 index 000000000000..4596d0d59d8b --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecureScoreControlDefinitionItem.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.resourcemanager.security.fluent.models.SecureScoreControlDefinitionItemInner; +import java.util.List; + +/** An immutable client-side representation of SecureScoreControlDefinitionItem. */ +public interface SecureScoreControlDefinitionItem { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the displayName property: User friendly display name of the control. + * + * @return the displayName value. + */ + String displayName(); + + /** + * Gets the description property: User friendly description of the control. + * + * @return the description value. + */ + String description(); + + /** + * Gets the maxScore property: Maximum control score (0..10). + * + * @return the maxScore value. + */ + Integer maxScore(); + + /** + * Gets the source property: Source object from which the control was created. + * + * @return the source value. + */ + SecureScoreControlDefinitionSource source(); + + /** + * Gets the assessmentDefinitions property: Array of assessments metadata IDs that are included in this security + * control. + * + * @return the assessmentDefinitions value. + */ + List assessmentDefinitions(); + + /** + * Gets the inner com.azure.resourcemanager.security.fluent.models.SecureScoreControlDefinitionItemInner object. + * + * @return the inner object. + */ + SecureScoreControlDefinitionItemInner innerModel(); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecureScoreControlDefinitionList.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecureScoreControlDefinitionList.java new file mode 100644 index 000000000000..3cbf3973c940 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecureScoreControlDefinitionList.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.models.SecureScoreControlDefinitionItemInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of security controls definition. */ +@Immutable +public final class SecureScoreControlDefinitionList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SecureScoreControlDefinitionList.class); + + /* + * Collection of security controls definition in this page + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * The URI to fetch the next page. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: Collection of security controls definition in this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The URI to fetch the next page. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecureScoreControlDefinitionSource.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecureScoreControlDefinitionSource.java new file mode 100644 index 000000000000..f451d33330f4 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecureScoreControlDefinitionSource.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The type of the security control (For example, BuiltIn). */ +@Fluent +public final class SecureScoreControlDefinitionSource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SecureScoreControlDefinitionSource.class); + + /* + * The type of security control (for example, BuiltIn) + */ + @JsonProperty(value = "sourceType") + private ControlType sourceType; + + /** + * Get the sourceType property: The type of security control (for example, BuiltIn). + * + * @return the sourceType value. + */ + public ControlType sourceType() { + return this.sourceType; + } + + /** + * Set the sourceType property: The type of security control (for example, BuiltIn). + * + * @param sourceType the sourceType value to set. + * @return the SecureScoreControlDefinitionSource object itself. + */ + public SecureScoreControlDefinitionSource withSourceType(ControlType sourceType) { + this.sourceType = sourceType; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecureScoreControlDefinitions.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecureScoreControlDefinitions.java new file mode 100644 index 000000000000..caaf29d80b7c --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecureScoreControlDefinitions.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of SecureScoreControlDefinitions. */ +public interface SecureScoreControlDefinitions { + /** + * List the available security controls, their assessments, and the max score. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security controls definition. + */ + PagedIterable list(); + + /** + * List the available security controls, their assessments, and the max score. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security controls definition. + */ + PagedIterable list(Context context); + + /** + * For a specified subscription, list the available security controls, their assessments, and the max score. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security controls definition. + */ + PagedIterable listBySubscription(); + + /** + * For a specified subscription, list the available security controls, their assessments, and the max score. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security controls definition. + */ + PagedIterable listBySubscription(Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecureScoreControlDetails.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecureScoreControlDetails.java new file mode 100644 index 000000000000..33f4ec67273f --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecureScoreControlDetails.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.resourcemanager.security.fluent.models.SecureScoreControlDetailsInner; + +/** An immutable client-side representation of SecureScoreControlDetails. */ +public interface SecureScoreControlDetails { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the displayName property: User friendly display name of the control. + * + * @return the displayName value. + */ + String displayName(); + + /** + * Gets the healthyResourceCount property: Number of healthy resources in the control. + * + * @return the healthyResourceCount value. + */ + Integer healthyResourceCount(); + + /** + * Gets the unhealthyResourceCount property: Number of unhealthy resources in the control. + * + * @return the unhealthyResourceCount value. + */ + Integer unhealthyResourceCount(); + + /** + * Gets the notApplicableResourceCount property: Number of not applicable resources in the control. + * + * @return the notApplicableResourceCount value. + */ + Integer notApplicableResourceCount(); + + /** + * Gets the weight property: The relative weight for this specific control in each of your subscriptions. Used when + * calculating an aggregated score for this control across all of your subscriptions. + * + * @return the weight value. + */ + Long weight(); + + /** + * Gets the definition property: Information about the security control. + * + * @return the definition value. + */ + SecureScoreControlDefinitionItem definition(); + + /** + * Gets the max property: Maximum score available. + * + * @return the max value. + */ + Integer max(); + + /** + * Gets the current property: Current score. + * + * @return the current value. + */ + Double current(); + + /** + * Gets the percentage property: Ratio of the current score divided by the maximum. Rounded to 4 digits after the + * decimal point. + * + * @return the percentage value. + */ + Double percentage(); + + /** + * Gets the inner com.azure.resourcemanager.security.fluent.models.SecureScoreControlDetailsInner object. + * + * @return the inner object. + */ + SecureScoreControlDetailsInner innerModel(); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecureScoreControlList.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecureScoreControlList.java new file mode 100644 index 000000000000..e1693293d0cd --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecureScoreControlList.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.models.SecureScoreControlDetailsInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of security controls. */ +@Immutable +public final class SecureScoreControlList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SecureScoreControlList.class); + + /* + * Collection of security controls in this page + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * The URI to fetch the next page. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: Collection of security controls in this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The URI to fetch the next page. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecureScoreControls.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecureScoreControls.java new file mode 100644 index 000000000000..7d70c5635020 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecureScoreControls.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of SecureScoreControls. */ +public interface SecureScoreControls { + /** + * Get all security controls for a specific initiative within a scope. + * + * @param secureScoreName The initiative name. For the ASC Default initiative, use 'ascScore' as in the sample + * request below. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all security controls for a specific initiative within a scope. + */ + PagedIterable listBySecureScore(String secureScoreName); + + /** + * Get all security controls for a specific initiative within a scope. + * + * @param secureScoreName The initiative name. For the ASC Default initiative, use 'ascScore' as in the sample + * request below. + * @param expand OData expand. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all security controls for a specific initiative within a scope. + */ + PagedIterable listBySecureScore( + String secureScoreName, ExpandControlsEnum expand, Context context); + + /** + * Get all security controls within a scope. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all security controls within a scope. + */ + PagedIterable list(); + + /** + * Get all security controls within a scope. + * + * @param expand OData expand. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all security controls within a scope. + */ + PagedIterable list(ExpandControlsEnum expand, Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecureScoreItem.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecureScoreItem.java new file mode 100644 index 000000000000..5115559f32bf --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecureScoreItem.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.resourcemanager.security.fluent.models.SecureScoreItemInner; + +/** An immutable client-side representation of SecureScoreItem. */ +public interface SecureScoreItem { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the displayName property: The initiative’s name. + * + * @return the displayName value. + */ + String displayName(); + + /** + * Gets the weight property: The relative weight for each subscription. Used when calculating an aggregated secure + * score for multiple subscriptions. + * + * @return the weight value. + */ + Long weight(); + + /** + * Gets the max property: Maximum score available. + * + * @return the max value. + */ + Integer max(); + + /** + * Gets the current property: Current score. + * + * @return the current value. + */ + Double current(); + + /** + * Gets the percentage property: Ratio of the current score divided by the maximum. Rounded to 4 digits after the + * decimal point. + * + * @return the percentage value. + */ + Double percentage(); + + /** + * Gets the inner com.azure.resourcemanager.security.fluent.models.SecureScoreItemInner object. + * + * @return the inner object. + */ + SecureScoreItemInner innerModel(); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecureScores.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecureScores.java new file mode 100644 index 000000000000..351d3a0397d9 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecureScores.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of SecureScores. */ +public interface SecureScores { + /** + * List secure scores for all your Security Center initiatives within your current scope. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of secure scores. + */ + PagedIterable list(); + + /** + * List secure scores for all your Security Center initiatives within your current scope. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of secure scores. + */ + PagedIterable list(Context context); + + /** + * Get secure score for a specific Security Center initiative within your current scope. For the ASC Default + * initiative, use 'ascScore'. + * + * @param secureScoreName The initiative name. For the ASC Default initiative, use 'ascScore' as in the sample + * request below. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return secure score for a specific Security Center initiative within your current scope. + */ + SecureScoreItem get(String secureScoreName); + + /** + * Get secure score for a specific Security Center initiative within your current scope. For the ASC Default + * initiative, use 'ascScore'. + * + * @param secureScoreName The initiative name. For the ASC Default initiative, use 'ascScore' as in the sample + * request below. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return secure score for a specific Security Center initiative within your current scope. + */ + Response getWithResponse(String secureScoreName, Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecureScoresList.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecureScoresList.java new file mode 100644 index 000000000000..34a87ac35fe1 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecureScoresList.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.models.SecureScoreItemInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of secure scores. */ +@Immutable +public final class SecureScoresList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SecureScoresList.class); + + /* + * Collection of secure scores in this page + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * The URI to fetch the next page. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: Collection of secure scores in this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The URI to fetch the next page. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecurityAssessment.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecurityAssessment.java new file mode 100644 index 000000000000..eb53f1d472c5 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecurityAssessment.java @@ -0,0 +1,280 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.SecurityAssessmentInner; +import java.util.Map; + +/** An immutable client-side representation of SecurityAssessment. */ +public interface SecurityAssessment { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the resourceDetails property: Details of the resource that was assessed. + * + * @return the resourceDetails value. + */ + ResourceDetails resourceDetails(); + + /** + * Gets the displayName property: User friendly display name of the assessment. + * + * @return the displayName value. + */ + String displayName(); + + /** + * Gets the status property: The result of the assessment. + * + * @return the status value. + */ + AssessmentStatus status(); + + /** + * Gets the additionalData property: Additional data regarding the assessment. + * + * @return the additionalData value. + */ + Map additionalData(); + + /** + * Gets the links property: Links relevant to the assessment. + * + * @return the links value. + */ + AssessmentLinks links(); + + /** + * Gets the metadata property: Describes properties of an assessment metadata. + * + * @return the metadata value. + */ + SecurityAssessmentMetadataProperties metadata(); + + /** + * Gets the partnersData property: Data regarding 3rd party partner integration. + * + * @return the partnersData value. + */ + SecurityAssessmentPartnerData partnersData(); + + /** + * Gets the inner com.azure.resourcemanager.security.fluent.models.SecurityAssessmentInner object. + * + * @return the inner object. + */ + SecurityAssessmentInner innerModel(); + + /** The entirety of the SecurityAssessment definition. */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithScope, DefinitionStages.WithCreate { + } + /** The SecurityAssessment definition stages. */ + interface DefinitionStages { + /** The first stage of the SecurityAssessment definition. */ + interface Blank extends WithScope { + } + /** The stage of the SecurityAssessment definition allowing to specify parent resource. */ + interface WithScope { + /** + * Specifies resourceId. + * + * @param resourceId The identifier of the resource. + * @return the next definition stage. + */ + WithCreate withExistingResourceId(String resourceId); + } + /** + * The stage of the SecurityAssessment definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithResourceDetails, + DefinitionStages.WithStatus, + DefinitionStages.WithAdditionalData, + DefinitionStages.WithMetadata, + DefinitionStages.WithPartnersData { + /** + * Executes the create request. + * + * @return the created resource. + */ + SecurityAssessment create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + SecurityAssessment create(Context context); + } + /** The stage of the SecurityAssessment definition allowing to specify resourceDetails. */ + interface WithResourceDetails { + /** + * Specifies the resourceDetails property: Details of the resource that was assessed. + * + * @param resourceDetails Details of the resource that was assessed. + * @return the next definition stage. + */ + WithCreate withResourceDetails(ResourceDetails resourceDetails); + } + /** The stage of the SecurityAssessment definition allowing to specify status. */ + interface WithStatus { + /** + * Specifies the status property: The result of the assessment. + * + * @param status The result of the assessment. + * @return the next definition stage. + */ + WithCreate withStatus(AssessmentStatus status); + } + /** The stage of the SecurityAssessment definition allowing to specify additionalData. */ + interface WithAdditionalData { + /** + * Specifies the additionalData property: Additional data regarding the assessment. + * + * @param additionalData Additional data regarding the assessment. + * @return the next definition stage. + */ + WithCreate withAdditionalData(Map additionalData); + } + /** The stage of the SecurityAssessment definition allowing to specify metadata. */ + interface WithMetadata { + /** + * Specifies the metadata property: Describes properties of an assessment metadata.. + * + * @param metadata Describes properties of an assessment metadata. + * @return the next definition stage. + */ + WithCreate withMetadata(SecurityAssessmentMetadataProperties metadata); + } + /** The stage of the SecurityAssessment definition allowing to specify partnersData. */ + interface WithPartnersData { + /** + * Specifies the partnersData property: Data regarding 3rd party partner integration. + * + * @param partnersData Data regarding 3rd party partner integration. + * @return the next definition stage. + */ + WithCreate withPartnersData(SecurityAssessmentPartnerData partnersData); + } + } + /** + * Begins update for the SecurityAssessment resource. + * + * @return the stage of resource update. + */ + SecurityAssessment.Update update(); + + /** The template for SecurityAssessment update. */ + interface Update + extends UpdateStages.WithResourceDetails, + UpdateStages.WithStatus, + UpdateStages.WithAdditionalData, + UpdateStages.WithMetadata, + UpdateStages.WithPartnersData { + /** + * Executes the update request. + * + * @return the updated resource. + */ + SecurityAssessment apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + SecurityAssessment apply(Context context); + } + /** The SecurityAssessment update stages. */ + interface UpdateStages { + /** The stage of the SecurityAssessment update allowing to specify resourceDetails. */ + interface WithResourceDetails { + /** + * Specifies the resourceDetails property: Details of the resource that was assessed. + * + * @param resourceDetails Details of the resource that was assessed. + * @return the next definition stage. + */ + Update withResourceDetails(ResourceDetails resourceDetails); + } + /** The stage of the SecurityAssessment update allowing to specify status. */ + interface WithStatus { + /** + * Specifies the status property: The result of the assessment. + * + * @param status The result of the assessment. + * @return the next definition stage. + */ + Update withStatus(AssessmentStatus status); + } + /** The stage of the SecurityAssessment update allowing to specify additionalData. */ + interface WithAdditionalData { + /** + * Specifies the additionalData property: Additional data regarding the assessment. + * + * @param additionalData Additional data regarding the assessment. + * @return the next definition stage. + */ + Update withAdditionalData(Map additionalData); + } + /** The stage of the SecurityAssessment update allowing to specify metadata. */ + interface WithMetadata { + /** + * Specifies the metadata property: Describes properties of an assessment metadata.. + * + * @param metadata Describes properties of an assessment metadata. + * @return the next definition stage. + */ + Update withMetadata(SecurityAssessmentMetadataProperties metadata); + } + /** The stage of the SecurityAssessment update allowing to specify partnersData. */ + interface WithPartnersData { + /** + * Specifies the partnersData property: Data regarding 3rd party partner integration. + * + * @param partnersData Data regarding 3rd party partner integration. + * @return the next definition stage. + */ + Update withPartnersData(SecurityAssessmentPartnerData partnersData); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + SecurityAssessment refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + SecurityAssessment refresh(Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecurityAssessmentList.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecurityAssessmentList.java new file mode 100644 index 000000000000..3894c6814932 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecurityAssessmentList.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.models.SecurityAssessmentInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Page of a security assessments list. */ +@Immutable +public final class SecurityAssessmentList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SecurityAssessmentList.class); + + /* + * Collection of security assessments in this page + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * The URI to fetch the next page. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: Collection of security assessments in this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The URI to fetch the next page. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecurityAssessmentMetadata.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecurityAssessmentMetadata.java new file mode 100644 index 000000000000..c16b0303f107 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecurityAssessmentMetadata.java @@ -0,0 +1,297 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.SecurityAssessmentMetadataInner; +import java.util.List; + +/** An immutable client-side representation of SecurityAssessmentMetadata. */ +public interface SecurityAssessmentMetadata { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the displayName property: User friendly display name of the assessment. + * + * @return the displayName value. + */ + String displayName(); + + /** + * Gets the policyDefinitionId property: Azure resource ID of the policy definition that turns this assessment + * calculation on. + * + * @return the policyDefinitionId value. + */ + String policyDefinitionId(); + + /** + * Gets the description property: Human readable description of the assessment. + * + * @return the description value. + */ + String description(); + + /** + * Gets the remediationDescription property: Human readable description of what you should do to mitigate this + * security issue. + * + * @return the remediationDescription value. + */ + String remediationDescription(); + + /** + * Gets the categories property: The categories property. + * + * @return the categories value. + */ + List categories(); + + /** + * Gets the severity property: The severity level of the assessment. + * + * @return the severity value. + */ + Severity severity(); + + /** + * Gets the userImpact property: The user impact of the assessment. + * + * @return the userImpact value. + */ + UserImpact userImpact(); + + /** + * Gets the implementationEffort property: The implementation effort required to remediate this assessment. + * + * @return the implementationEffort value. + */ + ImplementationEffort implementationEffort(); + + /** + * Gets the threats property: The threats property. + * + * @return the threats value. + */ + List threats(); + + /** + * Gets the preview property: True if this assessment is in preview release status. + * + * @return the preview value. + */ + Boolean preview(); + + /** + * Gets the assessmentType property: BuiltIn if the assessment based on built-in Azure Policy definition, Custom if + * the assessment based on custom Azure Policy definition. + * + * @return the assessmentType value. + */ + AssessmentType assessmentType(); + + /** + * Gets the partnerData property: Describes the partner that created the assessment. + * + * @return the partnerData value. + */ + SecurityAssessmentMetadataPartnerData partnerData(); + + /** + * Gets the inner com.azure.resourcemanager.security.fluent.models.SecurityAssessmentMetadataInner object. + * + * @return the inner object. + */ + SecurityAssessmentMetadataInner innerModel(); + + /** The entirety of the SecurityAssessmentMetadata definition. */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithCreate { + } + /** The SecurityAssessmentMetadata definition stages. */ + interface DefinitionStages { + /** The first stage of the SecurityAssessmentMetadata definition. */ + interface Blank extends WithCreate { + } + /** + * The stage of the SecurityAssessmentMetadata definition which contains all the minimum required properties for + * the resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithDisplayName, + DefinitionStages.WithDescription, + DefinitionStages.WithRemediationDescription, + DefinitionStages.WithCategories, + DefinitionStages.WithSeverity, + DefinitionStages.WithUserImpact, + DefinitionStages.WithImplementationEffort, + DefinitionStages.WithThreats, + DefinitionStages.WithPreview, + DefinitionStages.WithAssessmentType, + DefinitionStages.WithPartnerData { + /** + * Executes the create request. + * + * @return the created resource. + */ + SecurityAssessmentMetadata create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + SecurityAssessmentMetadata create(Context context); + } + /** The stage of the SecurityAssessmentMetadata definition allowing to specify displayName. */ + interface WithDisplayName { + /** + * Specifies the displayName property: User friendly display name of the assessment. + * + * @param displayName User friendly display name of the assessment. + * @return the next definition stage. + */ + WithCreate withDisplayName(String displayName); + } + /** The stage of the SecurityAssessmentMetadata definition allowing to specify description. */ + interface WithDescription { + /** + * Specifies the description property: Human readable description of the assessment. + * + * @param description Human readable description of the assessment. + * @return the next definition stage. + */ + WithCreate withDescription(String description); + } + /** The stage of the SecurityAssessmentMetadata definition allowing to specify remediationDescription. */ + interface WithRemediationDescription { + /** + * Specifies the remediationDescription property: Human readable description of what you should do to + * mitigate this security issue. + * + * @param remediationDescription Human readable description of what you should do to mitigate this security + * issue. + * @return the next definition stage. + */ + WithCreate withRemediationDescription(String remediationDescription); + } + /** The stage of the SecurityAssessmentMetadata definition allowing to specify categories. */ + interface WithCategories { + /** + * Specifies the categories property: The categories property.. + * + * @param categories The categories property. + * @return the next definition stage. + */ + WithCreate withCategories(List categories); + } + /** The stage of the SecurityAssessmentMetadata definition allowing to specify severity. */ + interface WithSeverity { + /** + * Specifies the severity property: The severity level of the assessment. + * + * @param severity The severity level of the assessment. + * @return the next definition stage. + */ + WithCreate withSeverity(Severity severity); + } + /** The stage of the SecurityAssessmentMetadata definition allowing to specify userImpact. */ + interface WithUserImpact { + /** + * Specifies the userImpact property: The user impact of the assessment. + * + * @param userImpact The user impact of the assessment. + * @return the next definition stage. + */ + WithCreate withUserImpact(UserImpact userImpact); + } + /** The stage of the SecurityAssessmentMetadata definition allowing to specify implementationEffort. */ + interface WithImplementationEffort { + /** + * Specifies the implementationEffort property: The implementation effort required to remediate this + * assessment. + * + * @param implementationEffort The implementation effort required to remediate this assessment. + * @return the next definition stage. + */ + WithCreate withImplementationEffort(ImplementationEffort implementationEffort); + } + /** The stage of the SecurityAssessmentMetadata definition allowing to specify threats. */ + interface WithThreats { + /** + * Specifies the threats property: The threats property.. + * + * @param threats The threats property. + * @return the next definition stage. + */ + WithCreate withThreats(List threats); + } + /** The stage of the SecurityAssessmentMetadata definition allowing to specify preview. */ + interface WithPreview { + /** + * Specifies the preview property: True if this assessment is in preview release status. + * + * @param preview True if this assessment is in preview release status. + * @return the next definition stage. + */ + WithCreate withPreview(Boolean preview); + } + /** The stage of the SecurityAssessmentMetadata definition allowing to specify assessmentType. */ + interface WithAssessmentType { + /** + * Specifies the assessmentType property: BuiltIn if the assessment based on built-in Azure Policy + * definition, Custom if the assessment based on custom Azure Policy definition. + * + * @param assessmentType BuiltIn if the assessment based on built-in Azure Policy definition, Custom if the + * assessment based on custom Azure Policy definition. + * @return the next definition stage. + */ + WithCreate withAssessmentType(AssessmentType assessmentType); + } + /** The stage of the SecurityAssessmentMetadata definition allowing to specify partnerData. */ + interface WithPartnerData { + /** + * Specifies the partnerData property: Describes the partner that created the assessment. + * + * @param partnerData Describes the partner that created the assessment. + * @return the next definition stage. + */ + WithCreate withPartnerData(SecurityAssessmentMetadataPartnerData partnerData); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + SecurityAssessmentMetadata refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + SecurityAssessmentMetadata refresh(Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecurityAssessmentMetadataList.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecurityAssessmentMetadataList.java new file mode 100644 index 000000000000..a38f0c3aff36 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecurityAssessmentMetadataList.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.models.SecurityAssessmentMetadataInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of security assessment metadata. */ +@Immutable +public final class SecurityAssessmentMetadataList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SecurityAssessmentMetadataList.class); + + /* + * The value property. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * The URI to fetch the next page. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: The value property. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The URI to fetch the next page. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecurityAssessmentMetadataPartnerData.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecurityAssessmentMetadataPartnerData.java new file mode 100644 index 000000000000..7c15d8f2bc93 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecurityAssessmentMetadataPartnerData.java @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Describes the partner that created the assessment. */ +@Fluent +public final class SecurityAssessmentMetadataPartnerData { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SecurityAssessmentMetadataPartnerData.class); + + /* + * Name of the company of the partner + */ + @JsonProperty(value = "partnerName", required = true) + private String partnerName; + + /* + * Name of the product of the partner that created the assessment + */ + @JsonProperty(value = "productName") + private String productName; + + /* + * Secret to authenticate the partner and verify it created the assessment + * - write only + */ + @JsonProperty(value = "secret", required = true) + private String secret; + + /** + * Get the partnerName property: Name of the company of the partner. + * + * @return the partnerName value. + */ + public String partnerName() { + return this.partnerName; + } + + /** + * Set the partnerName property: Name of the company of the partner. + * + * @param partnerName the partnerName value to set. + * @return the SecurityAssessmentMetadataPartnerData object itself. + */ + public SecurityAssessmentMetadataPartnerData withPartnerName(String partnerName) { + this.partnerName = partnerName; + return this; + } + + /** + * Get the productName property: Name of the product of the partner that created the assessment. + * + * @return the productName value. + */ + public String productName() { + return this.productName; + } + + /** + * Set the productName property: Name of the product of the partner that created the assessment. + * + * @param productName the productName value to set. + * @return the SecurityAssessmentMetadataPartnerData object itself. + */ + public SecurityAssessmentMetadataPartnerData withProductName(String productName) { + this.productName = productName; + return this; + } + + /** + * Get the secret property: Secret to authenticate the partner and verify it created the assessment - write only. + * + * @return the secret value. + */ + public String secret() { + return this.secret; + } + + /** + * Set the secret property: Secret to authenticate the partner and verify it created the assessment - write only. + * + * @param secret the secret value to set. + * @return the SecurityAssessmentMetadataPartnerData object itself. + */ + public SecurityAssessmentMetadataPartnerData withSecret(String secret) { + this.secret = secret; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (partnerName() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property partnerName in model SecurityAssessmentMetadataPartnerData")); + } + if (secret() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property secret in model SecurityAssessmentMetadataPartnerData")); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecurityAssessmentMetadataProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecurityAssessmentMetadataProperties.java new file mode 100644 index 000000000000..8e2cdcf2e7fe --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecurityAssessmentMetadataProperties.java @@ -0,0 +1,355 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Describes properties of an assessment metadata. */ +@Fluent +public final class SecurityAssessmentMetadataProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SecurityAssessmentMetadataProperties.class); + + /* + * User friendly display name of the assessment + */ + @JsonProperty(value = "displayName", required = true) + private String displayName; + + /* + * Azure resource ID of the policy definition that turns this assessment + * calculation on + */ + @JsonProperty(value = "policyDefinitionId", access = JsonProperty.Access.WRITE_ONLY) + private String policyDefinitionId; + + /* + * Human readable description of the assessment + */ + @JsonProperty(value = "description") + private String description; + + /* + * Human readable description of what you should do to mitigate this + * security issue + */ + @JsonProperty(value = "remediationDescription") + private String remediationDescription; + + /* + * The categories property. + */ + @JsonProperty(value = "categories") + private List categories; + + /* + * The severity level of the assessment + */ + @JsonProperty(value = "severity", required = true) + private Severity severity; + + /* + * The user impact of the assessment + */ + @JsonProperty(value = "userImpact") + private UserImpact userImpact; + + /* + * The implementation effort required to remediate this assessment + */ + @JsonProperty(value = "implementationEffort") + private ImplementationEffort implementationEffort; + + /* + * The threats property. + */ + @JsonProperty(value = "threats") + private List threats; + + /* + * True if this assessment is in preview release status + */ + @JsonProperty(value = "preview") + private Boolean preview; + + /* + * BuiltIn if the assessment based on built-in Azure Policy definition, + * Custom if the assessment based on custom Azure Policy definition + */ + @JsonProperty(value = "assessmentType", required = true) + private AssessmentType assessmentType; + + /* + * Describes the partner that created the assessment + */ + @JsonProperty(value = "partnerData") + private SecurityAssessmentMetadataPartnerData partnerData; + + /** + * Get the displayName property: User friendly display name of the assessment. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName property: User friendly display name of the assessment. + * + * @param displayName the displayName value to set. + * @return the SecurityAssessmentMetadataProperties object itself. + */ + public SecurityAssessmentMetadataProperties withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the policyDefinitionId property: Azure resource ID of the policy definition that turns this assessment + * calculation on. + * + * @return the policyDefinitionId value. + */ + public String policyDefinitionId() { + return this.policyDefinitionId; + } + + /** + * Get the description property: Human readable description of the assessment. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: Human readable description of the assessment. + * + * @param description the description value to set. + * @return the SecurityAssessmentMetadataProperties object itself. + */ + public SecurityAssessmentMetadataProperties withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the remediationDescription property: Human readable description of what you should do to mitigate this + * security issue. + * + * @return the remediationDescription value. + */ + public String remediationDescription() { + return this.remediationDescription; + } + + /** + * Set the remediationDescription property: Human readable description of what you should do to mitigate this + * security issue. + * + * @param remediationDescription the remediationDescription value to set. + * @return the SecurityAssessmentMetadataProperties object itself. + */ + public SecurityAssessmentMetadataProperties withRemediationDescription(String remediationDescription) { + this.remediationDescription = remediationDescription; + return this; + } + + /** + * Get the categories property: The categories property. + * + * @return the categories value. + */ + public List categories() { + return this.categories; + } + + /** + * Set the categories property: The categories property. + * + * @param categories the categories value to set. + * @return the SecurityAssessmentMetadataProperties object itself. + */ + public SecurityAssessmentMetadataProperties withCategories(List categories) { + this.categories = categories; + return this; + } + + /** + * Get the severity property: The severity level of the assessment. + * + * @return the severity value. + */ + public Severity severity() { + return this.severity; + } + + /** + * Set the severity property: The severity level of the assessment. + * + * @param severity the severity value to set. + * @return the SecurityAssessmentMetadataProperties object itself. + */ + public SecurityAssessmentMetadataProperties withSeverity(Severity severity) { + this.severity = severity; + return this; + } + + /** + * Get the userImpact property: The user impact of the assessment. + * + * @return the userImpact value. + */ + public UserImpact userImpact() { + return this.userImpact; + } + + /** + * Set the userImpact property: The user impact of the assessment. + * + * @param userImpact the userImpact value to set. + * @return the SecurityAssessmentMetadataProperties object itself. + */ + public SecurityAssessmentMetadataProperties withUserImpact(UserImpact userImpact) { + this.userImpact = userImpact; + return this; + } + + /** + * Get the implementationEffort property: The implementation effort required to remediate this assessment. + * + * @return the implementationEffort value. + */ + public ImplementationEffort implementationEffort() { + return this.implementationEffort; + } + + /** + * Set the implementationEffort property: The implementation effort required to remediate this assessment. + * + * @param implementationEffort the implementationEffort value to set. + * @return the SecurityAssessmentMetadataProperties object itself. + */ + public SecurityAssessmentMetadataProperties withImplementationEffort(ImplementationEffort implementationEffort) { + this.implementationEffort = implementationEffort; + return this; + } + + /** + * Get the threats property: The threats property. + * + * @return the threats value. + */ + public List threats() { + return this.threats; + } + + /** + * Set the threats property: The threats property. + * + * @param threats the threats value to set. + * @return the SecurityAssessmentMetadataProperties object itself. + */ + public SecurityAssessmentMetadataProperties withThreats(List threats) { + this.threats = threats; + return this; + } + + /** + * Get the preview property: True if this assessment is in preview release status. + * + * @return the preview value. + */ + public Boolean preview() { + return this.preview; + } + + /** + * Set the preview property: True if this assessment is in preview release status. + * + * @param preview the preview value to set. + * @return the SecurityAssessmentMetadataProperties object itself. + */ + public SecurityAssessmentMetadataProperties withPreview(Boolean preview) { + this.preview = preview; + return this; + } + + /** + * Get the assessmentType property: BuiltIn if the assessment based on built-in Azure Policy definition, Custom if + * the assessment based on custom Azure Policy definition. + * + * @return the assessmentType value. + */ + public AssessmentType assessmentType() { + return this.assessmentType; + } + + /** + * Set the assessmentType property: BuiltIn if the assessment based on built-in Azure Policy definition, Custom if + * the assessment based on custom Azure Policy definition. + * + * @param assessmentType the assessmentType value to set. + * @return the SecurityAssessmentMetadataProperties object itself. + */ + public SecurityAssessmentMetadataProperties withAssessmentType(AssessmentType assessmentType) { + this.assessmentType = assessmentType; + return this; + } + + /** + * Get the partnerData property: Describes the partner that created the assessment. + * + * @return the partnerData value. + */ + public SecurityAssessmentMetadataPartnerData partnerData() { + return this.partnerData; + } + + /** + * Set the partnerData property: Describes the partner that created the assessment. + * + * @param partnerData the partnerData value to set. + * @return the SecurityAssessmentMetadataProperties object itself. + */ + public SecurityAssessmentMetadataProperties withPartnerData(SecurityAssessmentMetadataPartnerData partnerData) { + this.partnerData = partnerData; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (displayName() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property displayName in model SecurityAssessmentMetadataProperties")); + } + if (severity() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property severity in model SecurityAssessmentMetadataProperties")); + } + if (assessmentType() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property assessmentType in model SecurityAssessmentMetadataProperties")); + } + if (partnerData() != null) { + partnerData().validate(); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecurityAssessmentPartnerData.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecurityAssessmentPartnerData.java new file mode 100644 index 000000000000..47a893b0477b --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecurityAssessmentPartnerData.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Data regarding 3rd party partner integration. */ +@Fluent +public final class SecurityAssessmentPartnerData { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SecurityAssessmentPartnerData.class); + + /* + * Name of the company of the partner + */ + @JsonProperty(value = "partnerName", required = true) + private String partnerName; + + /* + * secret to authenticate the partner - write only + */ + @JsonProperty(value = "secret", required = true) + private String secret; + + /** + * Get the partnerName property: Name of the company of the partner. + * + * @return the partnerName value. + */ + public String partnerName() { + return this.partnerName; + } + + /** + * Set the partnerName property: Name of the company of the partner. + * + * @param partnerName the partnerName value to set. + * @return the SecurityAssessmentPartnerData object itself. + */ + public SecurityAssessmentPartnerData withPartnerName(String partnerName) { + this.partnerName = partnerName; + return this; + } + + /** + * Get the secret property: secret to authenticate the partner - write only. + * + * @return the secret value. + */ + public String secret() { + return this.secret; + } + + /** + * Set the secret property: secret to authenticate the partner - write only. + * + * @param secret the secret value to set. + * @return the SecurityAssessmentPartnerData object itself. + */ + public SecurityAssessmentPartnerData withSecret(String secret) { + this.secret = secret; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (partnerName() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property partnerName in model SecurityAssessmentPartnerData")); + } + if (secret() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property secret in model SecurityAssessmentPartnerData")); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecurityContact.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecurityContact.java new file mode 100644 index 000000000000..34343e03e1a7 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecurityContact.java @@ -0,0 +1,230 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.SecurityContactInner; + +/** An immutable client-side representation of SecurityContact. */ +public interface SecurityContact { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the email property: The email of this security contact. + * + * @return the email value. + */ + String email(); + + /** + * Gets the phone property: The phone number of this security contact. + * + * @return the phone value. + */ + String phone(); + + /** + * Gets the alertNotifications property: Whether to send security alerts notifications to the security contact. + * + * @return the alertNotifications value. + */ + AlertNotifications alertNotifications(); + + /** + * Gets the alertsToAdmins property: Whether to send security alerts notifications to subscription admins. + * + * @return the alertsToAdmins value. + */ + AlertsToAdmins alertsToAdmins(); + + /** + * Gets the inner com.azure.resourcemanager.security.fluent.models.SecurityContactInner object. + * + * @return the inner object. + */ + SecurityContactInner innerModel(); + + /** The entirety of the SecurityContact definition. */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithCreate { + } + /** The SecurityContact definition stages. */ + interface DefinitionStages { + /** The first stage of the SecurityContact definition. */ + interface Blank extends WithCreate { + } + /** + * The stage of the SecurityContact definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithEmail, + DefinitionStages.WithPhone, + DefinitionStages.WithAlertNotifications, + DefinitionStages.WithAlertsToAdmins { + /** + * Executes the create request. + * + * @return the created resource. + */ + SecurityContact create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + SecurityContact create(Context context); + } + /** The stage of the SecurityContact definition allowing to specify email. */ + interface WithEmail { + /** + * Specifies the email property: The email of this security contact. + * + * @param email The email of this security contact. + * @return the next definition stage. + */ + WithCreate withEmail(String email); + } + /** The stage of the SecurityContact definition allowing to specify phone. */ + interface WithPhone { + /** + * Specifies the phone property: The phone number of this security contact. + * + * @param phone The phone number of this security contact. + * @return the next definition stage. + */ + WithCreate withPhone(String phone); + } + /** The stage of the SecurityContact definition allowing to specify alertNotifications. */ + interface WithAlertNotifications { + /** + * Specifies the alertNotifications property: Whether to send security alerts notifications to the security + * contact. + * + * @param alertNotifications Whether to send security alerts notifications to the security contact. + * @return the next definition stage. + */ + WithCreate withAlertNotifications(AlertNotifications alertNotifications); + } + /** The stage of the SecurityContact definition allowing to specify alertsToAdmins. */ + interface WithAlertsToAdmins { + /** + * Specifies the alertsToAdmins property: Whether to send security alerts notifications to subscription + * admins. + * + * @param alertsToAdmins Whether to send security alerts notifications to subscription admins. + * @return the next definition stage. + */ + WithCreate withAlertsToAdmins(AlertsToAdmins alertsToAdmins); + } + } + /** + * Begins update for the SecurityContact resource. + * + * @return the stage of resource update. + */ + SecurityContact.Update update(); + + /** The template for SecurityContact update. */ + interface Update + extends UpdateStages.WithEmail, + UpdateStages.WithPhone, + UpdateStages.WithAlertNotifications, + UpdateStages.WithAlertsToAdmins { + /** + * Executes the update request. + * + * @return the updated resource. + */ + SecurityContact apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + SecurityContact apply(Context context); + } + /** The SecurityContact update stages. */ + interface UpdateStages { + /** The stage of the SecurityContact update allowing to specify email. */ + interface WithEmail { + /** + * Specifies the email property: The email of this security contact. + * + * @param email The email of this security contact. + * @return the next definition stage. + */ + Update withEmail(String email); + } + /** The stage of the SecurityContact update allowing to specify phone. */ + interface WithPhone { + /** + * Specifies the phone property: The phone number of this security contact. + * + * @param phone The phone number of this security contact. + * @return the next definition stage. + */ + Update withPhone(String phone); + } + /** The stage of the SecurityContact update allowing to specify alertNotifications. */ + interface WithAlertNotifications { + /** + * Specifies the alertNotifications property: Whether to send security alerts notifications to the security + * contact. + * + * @param alertNotifications Whether to send security alerts notifications to the security contact. + * @return the next definition stage. + */ + Update withAlertNotifications(AlertNotifications alertNotifications); + } + /** The stage of the SecurityContact update allowing to specify alertsToAdmins. */ + interface WithAlertsToAdmins { + /** + * Specifies the alertsToAdmins property: Whether to send security alerts notifications to subscription + * admins. + * + * @param alertsToAdmins Whether to send security alerts notifications to subscription admins. + * @return the next definition stage. + */ + Update withAlertsToAdmins(AlertsToAdmins alertsToAdmins); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + SecurityContact refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + SecurityContact refresh(Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecurityContactList.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecurityContactList.java new file mode 100644 index 000000000000..1754fec386dc --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecurityContactList.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.models.SecurityContactInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of security contacts response. */ +@Immutable +public final class SecurityContactList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SecurityContactList.class); + + /* + * List of security contacts + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * The URI to fetch the next page. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: List of security contacts. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The URI to fetch the next page. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecurityContacts.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecurityContacts.java new file mode 100644 index 000000000000..d967c4c78122 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecurityContacts.java @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of SecurityContacts. */ +public interface SecurityContacts { + /** + * Security contact configurations for the subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security contacts response. + */ + PagedIterable list(); + + /** + * Security contact configurations for the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security contacts response. + */ + PagedIterable list(Context context); + + /** + * Security contact configurations for the subscription. + * + * @param securityContactName Name of the security contact object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return contact details for security issues. + */ + SecurityContact get(String securityContactName); + + /** + * Security contact configurations for the subscription. + * + * @param securityContactName Name of the security contact object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return contact details for security issues. + */ + Response getWithResponse(String securityContactName, Context context); + + /** + * Security contact configurations for the subscription. + * + * @param securityContactName Name of the security contact object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String securityContactName); + + /** + * Security contact configurations for the subscription. + * + * @param securityContactName Name of the security contact object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response deleteWithResponse(String securityContactName, Context context); + + /** + * Security contact configurations for the subscription. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return contact details for security issues. + */ + SecurityContact getById(String id); + + /** + * Security contact configurations for the subscription. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return contact details for security issues. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Security contact configurations for the subscription. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Security contact configurations for the subscription. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new SecurityContact resource. + * + * @param name resource name. + * @return the first stage of the new SecurityContact definition. + */ + SecurityContact.DefinitionStages.Blank define(String name); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecurityFamily.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecurityFamily.java new file mode 100644 index 000000000000..c56a994b3267 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecurityFamily.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for SecurityFamily. */ +public final class SecurityFamily extends ExpandableStringEnum { + /** Static value Waf for SecurityFamily. */ + public static final SecurityFamily WAF = fromString("Waf"); + + /** Static value Ngfw for SecurityFamily. */ + public static final SecurityFamily NGFW = fromString("Ngfw"); + + /** Static value SaasWaf for SecurityFamily. */ + public static final SecurityFamily SAAS_WAF = fromString("SaasWaf"); + + /** Static value Va for SecurityFamily. */ + public static final SecurityFamily VA = fromString("Va"); + + /** + * Creates or finds a SecurityFamily from its string representation. + * + * @param name a name to look for. + * @return the corresponding SecurityFamily. + */ + @JsonCreator + public static SecurityFamily fromString(String name) { + return fromString(name, SecurityFamily.class); + } + + /** @return known SecurityFamily values. */ + public static Collection values() { + return values(SecurityFamily.class); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecuritySolution.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecuritySolution.java new file mode 100644 index 000000000000..59c6c677f679 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecuritySolution.java @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.resourcemanager.security.fluent.models.SecuritySolutionInner; + +/** An immutable client-side representation of SecuritySolution. */ +public interface SecuritySolution { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the securityFamily property: The security family of the security solution. + * + * @return the securityFamily value. + */ + SecurityFamily securityFamily(); + + /** + * Gets the provisioningState property: The security family provisioning State. + * + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * Gets the template property: The security solutions' template. + * + * @return the template value. + */ + String template(); + + /** + * Gets the protectionStatus property: The security solutions' status. + * + * @return the protectionStatus value. + */ + String protectionStatus(); + + /** + * Gets the location property: Location where the resource is stored. + * + * @return the location value. + */ + String location(); + + /** + * Gets the inner com.azure.resourcemanager.security.fluent.models.SecuritySolutionInner object. + * + * @return the inner object. + */ + SecuritySolutionInner innerModel(); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecuritySolutionList.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecuritySolutionList.java new file mode 100644 index 000000000000..879cdc07200d --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecuritySolutionList.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.models.SecuritySolutionInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The SecuritySolutionList model. */ +@Fluent +public final class SecuritySolutionList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SecuritySolutionList.class); + + /* + * The value property. + */ + @JsonProperty(value = "value") + private List value; + + /* + * The URI to fetch the next page. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: The value property. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The value property. + * + * @param value the value value to set. + * @return the SecuritySolutionList object itself. + */ + public SecuritySolutionList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The URI to fetch the next page. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecuritySolutionStatus.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecuritySolutionStatus.java new file mode 100644 index 000000000000..61fd4483a47b --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecuritySolutionStatus.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for SecuritySolutionStatus. */ +public final class SecuritySolutionStatus extends ExpandableStringEnum { + /** Static value Enabled for SecuritySolutionStatus. */ + public static final SecuritySolutionStatus ENABLED = fromString("Enabled"); + + /** Static value Disabled for SecuritySolutionStatus. */ + public static final SecuritySolutionStatus DISABLED = fromString("Disabled"); + + /** + * Creates or finds a SecuritySolutionStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding SecuritySolutionStatus. + */ + @JsonCreator + public static SecuritySolutionStatus fromString(String name) { + return fromString(name, SecuritySolutionStatus.class); + } + + /** @return known SecuritySolutionStatus values. */ + public static Collection values() { + return values(SecuritySolutionStatus.class); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecuritySolutions.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecuritySolutions.java new file mode 100644 index 000000000000..219e37f99669 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecuritySolutions.java @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of SecuritySolutions. */ +public interface SecuritySolutions { + /** + * Gets a list of Security Solutions for the subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Security Solutions for the subscription. + */ + PagedIterable list(); + + /** + * Gets a list of Security Solutions for the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Security Solutions for the subscription. + */ + PagedIterable list(Context context); + + /** + * Gets a specific Security Solution. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param securitySolutionName Name of security solution. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a specific Security Solution. + */ + SecuritySolution get(String resourceGroupName, String ascLocation, String securitySolutionName); + + /** + * Gets a specific Security Solution. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param securitySolutionName Name of security solution. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a specific Security Solution. + */ + Response getWithResponse( + String resourceGroupName, String ascLocation, String securitySolutionName, Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecuritySolutionsReferenceData.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecuritySolutionsReferenceData.java new file mode 100644 index 000000000000..a3e4ced14832 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecuritySolutionsReferenceData.java @@ -0,0 +1,266 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The SecuritySolutionsReferenceData model. */ +@JsonFlatten +@Fluent +public class SecuritySolutionsReferenceData extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SecuritySolutionsReferenceData.class); + + /* + * The security family of the security solution + */ + @JsonProperty(value = "properties.securityFamily", required = true) + private SecurityFamily securityFamily; + + /* + * The security solutions' vendor name + */ + @JsonProperty(value = "properties.alertVendorName", required = true) + private String alertVendorName; + + /* + * The security solutions' package info url + */ + @JsonProperty(value = "properties.packageInfoUrl", required = true) + private String packageInfoUrl; + + /* + * The security solutions' product name + */ + @JsonProperty(value = "properties.productName", required = true) + private String productName; + + /* + * The security solutions' publisher + */ + @JsonProperty(value = "properties.publisher", required = true) + private String publisher; + + /* + * The security solutions' publisher display name + */ + @JsonProperty(value = "properties.publisherDisplayName", required = true) + private String publisherDisplayName; + + /* + * The security solutions' template + */ + @JsonProperty(value = "properties.template", required = true) + private String template; + + /* + * Location where the resource is stored + */ + @JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY) + private String location; + + /** + * Get the securityFamily property: The security family of the security solution. + * + * @return the securityFamily value. + */ + public SecurityFamily securityFamily() { + return this.securityFamily; + } + + /** + * Set the securityFamily property: The security family of the security solution. + * + * @param securityFamily the securityFamily value to set. + * @return the SecuritySolutionsReferenceData object itself. + */ + public SecuritySolutionsReferenceData withSecurityFamily(SecurityFamily securityFamily) { + this.securityFamily = securityFamily; + return this; + } + + /** + * Get the alertVendorName property: The security solutions' vendor name. + * + * @return the alertVendorName value. + */ + public String alertVendorName() { + return this.alertVendorName; + } + + /** + * Set the alertVendorName property: The security solutions' vendor name. + * + * @param alertVendorName the alertVendorName value to set. + * @return the SecuritySolutionsReferenceData object itself. + */ + public SecuritySolutionsReferenceData withAlertVendorName(String alertVendorName) { + this.alertVendorName = alertVendorName; + return this; + } + + /** + * Get the packageInfoUrl property: The security solutions' package info url. + * + * @return the packageInfoUrl value. + */ + public String packageInfoUrl() { + return this.packageInfoUrl; + } + + /** + * Set the packageInfoUrl property: The security solutions' package info url. + * + * @param packageInfoUrl the packageInfoUrl value to set. + * @return the SecuritySolutionsReferenceData object itself. + */ + public SecuritySolutionsReferenceData withPackageInfoUrl(String packageInfoUrl) { + this.packageInfoUrl = packageInfoUrl; + return this; + } + + /** + * Get the productName property: The security solutions' product name. + * + * @return the productName value. + */ + public String productName() { + return this.productName; + } + + /** + * Set the productName property: The security solutions' product name. + * + * @param productName the productName value to set. + * @return the SecuritySolutionsReferenceData object itself. + */ + public SecuritySolutionsReferenceData withProductName(String productName) { + this.productName = productName; + return this; + } + + /** + * Get the publisher property: The security solutions' publisher. + * + * @return the publisher value. + */ + public String publisher() { + return this.publisher; + } + + /** + * Set the publisher property: The security solutions' publisher. + * + * @param publisher the publisher value to set. + * @return the SecuritySolutionsReferenceData object itself. + */ + public SecuritySolutionsReferenceData withPublisher(String publisher) { + this.publisher = publisher; + return this; + } + + /** + * Get the publisherDisplayName property: The security solutions' publisher display name. + * + * @return the publisherDisplayName value. + */ + public String publisherDisplayName() { + return this.publisherDisplayName; + } + + /** + * Set the publisherDisplayName property: The security solutions' publisher display name. + * + * @param publisherDisplayName the publisherDisplayName value to set. + * @return the SecuritySolutionsReferenceData object itself. + */ + public SecuritySolutionsReferenceData withPublisherDisplayName(String publisherDisplayName) { + this.publisherDisplayName = publisherDisplayName; + return this; + } + + /** + * Get the template property: The security solutions' template. + * + * @return the template value. + */ + public String template() { + return this.template; + } + + /** + * Set the template property: The security solutions' template. + * + * @param template the template value to set. + * @return the SecuritySolutionsReferenceData object itself. + */ + public SecuritySolutionsReferenceData withTemplate(String template) { + this.template = template; + return this; + } + + /** + * Get the location property: Location where the resource is stored. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (securityFamily() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property securityFamily in model SecuritySolutionsReferenceData")); + } + if (alertVendorName() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property alertVendorName in model SecuritySolutionsReferenceData")); + } + if (packageInfoUrl() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property packageInfoUrl in model SecuritySolutionsReferenceData")); + } + if (productName() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property productName in model SecuritySolutionsReferenceData")); + } + if (publisher() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property publisher in model SecuritySolutionsReferenceData")); + } + if (publisherDisplayName() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property publisherDisplayName in model SecuritySolutionsReferenceData")); + } + if (template() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property template in model SecuritySolutionsReferenceData")); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecuritySolutionsReferenceDataList.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecuritySolutionsReferenceDataList.java new file mode 100644 index 000000000000..bc0da29b13c6 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecuritySolutionsReferenceDataList.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.resourcemanager.security.fluent.models.SecuritySolutionsReferenceDataListInner; +import java.util.List; + +/** An immutable client-side representation of SecuritySolutionsReferenceDataList. */ +public interface SecuritySolutionsReferenceDataList { + /** + * Gets the value property: The value property. + * + * @return the value value. + */ + List value(); + + /** + * Gets the inner com.azure.resourcemanager.security.fluent.models.SecuritySolutionsReferenceDataListInner object. + * + * @return the inner object. + */ + SecuritySolutionsReferenceDataListInner innerModel(); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecuritySolutionsReferenceDatas.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecuritySolutionsReferenceDatas.java new file mode 100644 index 000000000000..e2207b857b48 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecuritySolutionsReferenceDatas.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of SecuritySolutionsReferenceDatas. */ +public interface SecuritySolutionsReferenceDatas { + /** + * Gets a list of all supported Security Solutions for the subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all supported Security Solutions for the subscription. + */ + SecuritySolutionsReferenceDataList list(); + + /** + * Gets a list of all supported Security Solutions for the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all supported Security Solutions for the subscription. + */ + Response listWithResponse(Context context); + + /** + * Gets list of all supported Security Solutions for subscription and location. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of all supported Security Solutions for subscription and location. + */ + SecuritySolutionsReferenceDataList listByHomeRegion(String ascLocation); + + /** + * Gets list of all supported Security Solutions for subscription and location. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of all supported Security Solutions for subscription and location. + */ + Response listByHomeRegionWithResponse(String ascLocation, Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecuritySubAssessment.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecuritySubAssessment.java new file mode 100644 index 000000000000..d76b91acfed1 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecuritySubAssessment.java @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.resourcemanager.security.fluent.models.SecuritySubAssessmentInner; +import java.time.OffsetDateTime; + +/** An immutable client-side representation of SecuritySubAssessment. */ +public interface SecuritySubAssessment { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the idPropertiesId property: Vulnerability ID. + * + * @return the idPropertiesId value. + */ + String idPropertiesId(); + + /** + * Gets the displayName property: User friendly display name of the sub-assessment. + * + * @return the displayName value. + */ + String displayName(); + + /** + * Gets the status property: Status of the sub-assessment. + * + * @return the status value. + */ + SubAssessmentStatus status(); + + /** + * Gets the remediation property: Information on how to remediate this sub-assessment. + * + * @return the remediation value. + */ + String remediation(); + + /** + * Gets the impact property: Description of the impact of this sub-assessment. + * + * @return the impact value. + */ + String impact(); + + /** + * Gets the category property: Category of the sub-assessment. + * + * @return the category value. + */ + String category(); + + /** + * Gets the description property: Human readable description of the assessment status. + * + * @return the description value. + */ + String description(); + + /** + * Gets the timeGenerated property: The date and time the sub-assessment was generated. + * + * @return the timeGenerated value. + */ + OffsetDateTime timeGenerated(); + + /** + * Gets the resourceDetails property: Details of the resource that was assessed. + * + * @return the resourceDetails value. + */ + ResourceDetails resourceDetails(); + + /** + * Gets the additionalData property: Details of the sub-assessment. + * + * @return the additionalData value. + */ + AdditionalData additionalData(); + + /** + * Gets the inner com.azure.resourcemanager.security.fluent.models.SecuritySubAssessmentInner object. + * + * @return the inner object. + */ + SecuritySubAssessmentInner innerModel(); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecuritySubAssessmentList.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecuritySubAssessmentList.java new file mode 100644 index 000000000000..cd588f1641c5 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecuritySubAssessmentList.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.models.SecuritySubAssessmentInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of security sub-assessments. */ +@Immutable +public final class SecuritySubAssessmentList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SecuritySubAssessmentList.class); + + /* + * The value property. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * The URI to fetch the next page. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: The value property. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The URI to fetch the next page. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecurityTask.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecurityTask.java new file mode 100644 index 000000000000..48c8ca3e14be --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecurityTask.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.resourcemanager.security.fluent.models.SecurityTaskInner; +import java.time.OffsetDateTime; + +/** An immutable client-side representation of SecurityTask. */ +public interface SecurityTask { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the state property: State of the task (Active, Resolved etc.). + * + * @return the state value. + */ + String state(); + + /** + * Gets the creationTimeUtc property: The time this task was discovered in UTC. + * + * @return the creationTimeUtc value. + */ + OffsetDateTime creationTimeUtc(); + + /** + * Gets the securityTaskParameters property: Changing set of properties, depending on the task type that is derived + * from the name field. + * + * @return the securityTaskParameters value. + */ + SecurityTaskParameters securityTaskParameters(); + + /** + * Gets the lastStateChangeTimeUtc property: The time this task's details were last changed in UTC. + * + * @return the lastStateChangeTimeUtc value. + */ + OffsetDateTime lastStateChangeTimeUtc(); + + /** + * Gets the subState property: Additional data on the state of the task. + * + * @return the subState value. + */ + String subState(); + + /** + * Gets the inner com.azure.resourcemanager.security.fluent.models.SecurityTaskInner object. + * + * @return the inner object. + */ + SecurityTaskInner innerModel(); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecurityTaskList.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecurityTaskList.java new file mode 100644 index 000000000000..c73a8e6c26a7 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecurityTaskList.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.models.SecurityTaskInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of security task recommendations. */ +@Immutable +public final class SecurityTaskList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SecurityTaskList.class); + + /* + * The value property. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * The URI to fetch the next page. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: The value property. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The URI to fetch the next page. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecurityTaskParameters.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecurityTaskParameters.java new file mode 100644 index 000000000000..ec8ab8a9f1e0 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecurityTaskParameters.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.HashMap; +import java.util.Map; + +/** Changing set of properties, depending on the task type that is derived from the name field. */ +@Fluent +public final class SecurityTaskParameters { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SecurityTaskParameters.class); + + /* + * Name of the task type + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * Changing set of properties, depending on the task type that is derived + * from the name field + */ + @JsonIgnore private Map additionalProperties; + + /** + * Get the name property: Name of the task type. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the additionalProperties property: Changing set of properties, depending on the task type that is derived + * from the name field. + * + * @return the additionalProperties value. + */ + @JsonAnyGetter + public Map additionalProperties() { + return this.additionalProperties; + } + + /** + * Set the additionalProperties property: Changing set of properties, depending on the task type that is derived + * from the name field. + * + * @param additionalProperties the additionalProperties value to set. + * @return the SecurityTaskParameters object itself. + */ + public SecurityTaskParameters withAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + @JsonAnySetter + void withAdditionalProperties(String key, Object value) { + if (additionalProperties == null) { + additionalProperties = new HashMap<>(); + } + additionalProperties.put(key, value); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SensitivityLabel.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SensitivityLabel.java new file mode 100644 index 000000000000..b4220c8590b3 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SensitivityLabel.java @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The sensitivity label. */ +@Fluent +public final class SensitivityLabel { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SensitivityLabel.class); + + /* + * The name of the sensitivity label. + */ + @JsonProperty(value = "displayName") + private String displayName; + + /* + * The description of the sensitivity label. + */ + @JsonProperty(value = "description") + private String description; + + /* + * The rank of the sensitivity label. + */ + @JsonProperty(value = "rank") + private Rank rank; + + /* + * The order of the sensitivity label. + */ + @JsonProperty(value = "order") + private Integer order; + + /* + * Indicates whether the label is enabled or not. + */ + @JsonProperty(value = "enabled") + private Boolean enabled; + + /** + * Get the displayName property: The name of the sensitivity label. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName property: The name of the sensitivity label. + * + * @param displayName the displayName value to set. + * @return the SensitivityLabel object itself. + */ + public SensitivityLabel withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the description property: The description of the sensitivity label. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: The description of the sensitivity label. + * + * @param description the description value to set. + * @return the SensitivityLabel object itself. + */ + public SensitivityLabel withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the rank property: The rank of the sensitivity label. + * + * @return the rank value. + */ + public Rank rank() { + return this.rank; + } + + /** + * Set the rank property: The rank of the sensitivity label. + * + * @param rank the rank value to set. + * @return the SensitivityLabel object itself. + */ + public SensitivityLabel withRank(Rank rank) { + this.rank = rank; + return this; + } + + /** + * Get the order property: The order of the sensitivity label. + * + * @return the order value. + */ + public Integer order() { + return this.order; + } + + /** + * Set the order property: The order of the sensitivity label. + * + * @param order the order value to set. + * @return the SensitivityLabel object itself. + */ + public SensitivityLabel withOrder(Integer order) { + this.order = order; + return this; + } + + /** + * Get the enabled property: Indicates whether the label is enabled or not. + * + * @return the enabled value. + */ + public Boolean enabled() { + return this.enabled; + } + + /** + * Set the enabled property: Indicates whether the label is enabled or not. + * + * @param enabled the enabled value to set. + * @return the SensitivityLabel object itself. + */ + public SensitivityLabel withEnabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Sensor.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Sensor.java new file mode 100644 index 000000000000..466b9593cf6a --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Sensor.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Sensor data. */ +@Immutable +public final class Sensor { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Sensor.class); + + /* + * Sensor name + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * Zone Name. + */ + @JsonProperty(value = "zone", access = JsonProperty.Access.WRITE_ONLY) + private String zone; + + /** + * Get the name property: Sensor name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the zone property: Zone Name. + * + * @return the zone value. + */ + public String zone() { + return this.zone; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SensorStatus.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SensorStatus.java new file mode 100644 index 000000000000..bfddff37d516 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SensorStatus.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for SensorStatus. */ +public final class SensorStatus extends ExpandableStringEnum { + /** Static value Ok for SensorStatus. */ + public static final SensorStatus OK = fromString("Ok"); + + /** Static value Disconnected for SensorStatus. */ + public static final SensorStatus DISCONNECTED = fromString("Disconnected"); + + /** Static value Unavailable for SensorStatus. */ + public static final SensorStatus UNAVAILABLE = fromString("Unavailable"); + + /** + * Creates or finds a SensorStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding SensorStatus. + */ + @JsonCreator + public static SensorStatus fromString(String name) { + return fromString(name, SensorStatus.class); + } + + /** @return known SensorStatus values. */ + public static Collection values() { + return values(SensorStatus.class); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SensorType.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SensorType.java new file mode 100644 index 000000000000..b500d0c1bd7b --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SensorType.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for SensorType. */ +public final class SensorType extends ExpandableStringEnum { + /** Static value Ot for SensorType. */ + public static final SensorType OT = fromString("Ot"); + + /** Static value Enterprise for SensorType. */ + public static final SensorType ENTERPRISE = fromString("Enterprise"); + + /** + * Creates or finds a SensorType from its string representation. + * + * @param name a name to look for. + * @return the corresponding SensorType. + */ + @JsonCreator + public static SensorType fromString(String name) { + return fromString(name, SensorType.class); + } + + /** @return known SensorType values. */ + public static Collection values() { + return values(SensorType.class); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ServerVulnerabilityAssessment.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ServerVulnerabilityAssessment.java new file mode 100644 index 000000000000..56fd354690ed --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ServerVulnerabilityAssessment.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.resourcemanager.security.fluent.models.ServerVulnerabilityAssessmentInner; + +/** An immutable client-side representation of ServerVulnerabilityAssessment. */ +public interface ServerVulnerabilityAssessment { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the provisioningState property: The provisioningState of the vulnerability assessment capability on the VM. + * + * @return the provisioningState value. + */ + ServerVulnerabilityAssessmentPropertiesProvisioningState provisioningState(); + + /** + * Gets the inner com.azure.resourcemanager.security.fluent.models.ServerVulnerabilityAssessmentInner object. + * + * @return the inner object. + */ + ServerVulnerabilityAssessmentInner innerModel(); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ServerVulnerabilityAssessmentPropertiesProvisioningState.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ServerVulnerabilityAssessmentPropertiesProvisioningState.java new file mode 100644 index 000000000000..254df6f615b7 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ServerVulnerabilityAssessmentPropertiesProvisioningState.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ServerVulnerabilityAssessmentPropertiesProvisioningState. */ +public final class ServerVulnerabilityAssessmentPropertiesProvisioningState + extends ExpandableStringEnum { + /** Static value Succeeded for ServerVulnerabilityAssessmentPropertiesProvisioningState. */ + public static final ServerVulnerabilityAssessmentPropertiesProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** Static value Failed for ServerVulnerabilityAssessmentPropertiesProvisioningState. */ + public static final ServerVulnerabilityAssessmentPropertiesProvisioningState FAILED = fromString("Failed"); + + /** Static value Canceled for ServerVulnerabilityAssessmentPropertiesProvisioningState. */ + public static final ServerVulnerabilityAssessmentPropertiesProvisioningState CANCELED = fromString("Canceled"); + + /** Static value Provisioning for ServerVulnerabilityAssessmentPropertiesProvisioningState. */ + public static final ServerVulnerabilityAssessmentPropertiesProvisioningState PROVISIONING = + fromString("Provisioning"); + + /** Static value Deprovisioning for ServerVulnerabilityAssessmentPropertiesProvisioningState. */ + public static final ServerVulnerabilityAssessmentPropertiesProvisioningState DEPROVISIONING = + fromString("Deprovisioning"); + + /** + * Creates or finds a ServerVulnerabilityAssessmentPropertiesProvisioningState from its string representation. + * + * @param name a name to look for. + * @return the corresponding ServerVulnerabilityAssessmentPropertiesProvisioningState. + */ + @JsonCreator + public static ServerVulnerabilityAssessmentPropertiesProvisioningState fromString(String name) { + return fromString(name, ServerVulnerabilityAssessmentPropertiesProvisioningState.class); + } + + /** @return known ServerVulnerabilityAssessmentPropertiesProvisioningState values. */ + public static Collection values() { + return values(ServerVulnerabilityAssessmentPropertiesProvisioningState.class); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ServerVulnerabilityAssessments.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ServerVulnerabilityAssessments.java new file mode 100644 index 000000000000..a08ad2f5bada --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ServerVulnerabilityAssessments.java @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of ServerVulnerabilityAssessments. */ +public interface ServerVulnerabilityAssessments { + /** + * Gets a list of server vulnerability assessment onboarding statuses on a given resource. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server vulnerability assessment onboarding statuses on a given resource. + */ + ServerVulnerabilityAssessmentsList listByExtendedResource( + String resourceGroupName, String resourceNamespace, String resourceType, String resourceName); + + /** + * Gets a list of server vulnerability assessment onboarding statuses on a given resource. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server vulnerability assessment onboarding statuses on a given resource. + */ + Response listByExtendedResourceWithResponse( + String resourceGroupName, String resourceNamespace, String resourceType, String resourceName, Context context); + + /** + * Gets a server vulnerability assessment onboarding statuses on a given resource. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server vulnerability assessment onboarding statuses on a given resource. + */ + ServerVulnerabilityAssessment get( + String resourceGroupName, String resourceNamespace, String resourceType, String resourceName); + + /** + * Gets a server vulnerability assessment onboarding statuses on a given resource. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server vulnerability assessment onboarding statuses on a given resource. + */ + Response getWithResponse( + String resourceGroupName, String resourceNamespace, String resourceType, String resourceName, Context context); + + /** + * Creating a server vulnerability assessment on a resource, which will onboard a resource for having a + * vulnerability assessment on it. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the server vulnerability assessment details on a resource. + */ + ServerVulnerabilityAssessment createOrUpdate( + String resourceGroupName, String resourceNamespace, String resourceType, String resourceName); + + /** + * Creating a server vulnerability assessment on a resource, which will onboard a resource for having a + * vulnerability assessment on it. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the server vulnerability assessment details on a resource. + */ + Response createOrUpdateWithResponse( + String resourceGroupName, String resourceNamespace, String resourceType, String resourceName, Context context); + + /** + * Removing server vulnerability assessment from a resource. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String resourceNamespace, String resourceType, String resourceName); + + /** + * Removing server vulnerability assessment from a resource. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete( + String resourceGroupName, String resourceNamespace, String resourceType, String resourceName, Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ServerVulnerabilityAssessmentsList.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ServerVulnerabilityAssessmentsList.java new file mode 100644 index 000000000000..353e2bc0441c --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ServerVulnerabilityAssessmentsList.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.resourcemanager.security.fluent.models.ServerVulnerabilityAssessmentsListInner; +import java.util.List; + +/** An immutable client-side representation of ServerVulnerabilityAssessmentsList. */ +public interface ServerVulnerabilityAssessmentsList { + /** + * Gets the value property: The value property. + * + * @return the value value. + */ + List value(); + + /** + * Gets the inner com.azure.resourcemanager.security.fluent.models.ServerVulnerabilityAssessmentsListInner object. + * + * @return the inner object. + */ + ServerVulnerabilityAssessmentsListInner innerModel(); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ServerVulnerabilityProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ServerVulnerabilityProperties.java new file mode 100644 index 000000000000..8ff2556b1283 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ServerVulnerabilityProperties.java @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; + +/** Additional context fields for server vulnerability assessment. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "assessedResourceType") +@JsonTypeName("ServerVulnerabilityAssessment") +@Immutable +public final class ServerVulnerabilityProperties extends AdditionalData { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServerVulnerabilityProperties.class); + + /* + * Vulnerability Type. e.g: Vulnerability, Potential Vulnerability, + * Information Gathered + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /* + * Dictionary from cvss version to cvss details object + */ + @JsonProperty(value = "cvss", access = JsonProperty.Access.WRITE_ONLY) + private Map cvss; + + /* + * Indicates whether a patch is available or not + */ + @JsonProperty(value = "patchable", access = JsonProperty.Access.WRITE_ONLY) + private Boolean patchable; + + /* + * List of CVEs + */ + @JsonProperty(value = "cve", access = JsonProperty.Access.WRITE_ONLY) + private List cve; + + /* + * Threat name + */ + @JsonProperty(value = "threat", access = JsonProperty.Access.WRITE_ONLY) + private String threat; + + /* + * Published time + */ + @JsonProperty(value = "publishedTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime publishedTime; + + /* + * The vendorReferences property. + */ + @JsonProperty(value = "vendorReferences", access = JsonProperty.Access.WRITE_ONLY) + private List vendorReferences; + + /** + * Get the type property: Vulnerability Type. e.g: Vulnerability, Potential Vulnerability, Information Gathered. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Get the cvss property: Dictionary from cvss version to cvss details object. + * + * @return the cvss value. + */ + public Map cvss() { + return this.cvss; + } + + /** + * Get the patchable property: Indicates whether a patch is available or not. + * + * @return the patchable value. + */ + public Boolean patchable() { + return this.patchable; + } + + /** + * Get the cve property: List of CVEs. + * + * @return the cve value. + */ + public List cve() { + return this.cve; + } + + /** + * Get the threat property: Threat name. + * + * @return the threat value. + */ + public String threat() { + return this.threat; + } + + /** + * Get the publishedTime property: Published time. + * + * @return the publishedTime value. + */ + public OffsetDateTime publishedTime() { + return this.publishedTime; + } + + /** + * Get the vendorReferences property: The vendorReferences property. + * + * @return the vendorReferences value. + */ + public List vendorReferences() { + return this.vendorReferences; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (cvss() != null) { + cvss() + .values() + .forEach( + e -> { + if (e != null) { + e.validate(); + } + }); + } + if (cve() != null) { + cve().forEach(e -> e.validate()); + } + if (vendorReferences() != null) { + vendorReferences().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ServicePrincipalProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ServicePrincipalProperties.java new file mode 100644 index 000000000000..761b335438b9 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ServicePrincipalProperties.java @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Details of the service principal. */ +@Fluent +public final class ServicePrincipalProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServicePrincipalProperties.class); + + /* + * Application ID of service principal. + */ + @JsonProperty(value = "applicationId") + private String applicationId; + + /* + * A secret string that the application uses to prove its identity, also + * can be referred to as application password (write only). + */ + @JsonProperty(value = "secret") + private String secret; + + /** + * Get the applicationId property: Application ID of service principal. + * + * @return the applicationId value. + */ + public String applicationId() { + return this.applicationId; + } + + /** + * Set the applicationId property: Application ID of service principal. + * + * @param applicationId the applicationId value to set. + * @return the ServicePrincipalProperties object itself. + */ + public ServicePrincipalProperties withApplicationId(String applicationId) { + this.applicationId = applicationId; + return this; + } + + /** + * Get the secret property: A secret string that the application uses to prove its identity, also can be referred to + * as application password (write only). + * + * @return the secret value. + */ + public String secret() { + return this.secret; + } + + /** + * Set the secret property: A secret string that the application uses to prove its identity, also can be referred to + * as application password (write only). + * + * @param secret the secret value to set. + * @return the ServicePrincipalProperties object itself. + */ + public ServicePrincipalProperties withSecret(String secret) { + this.secret = secret; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Setting.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Setting.java new file mode 100644 index 000000000000..ea3ec718e969 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Setting.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.resourcemanager.security.fluent.models.SettingInner; + +/** An immutable client-side representation of Setting. */ +public interface Setting { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the inner com.azure.resourcemanager.security.fluent.models.SettingInner object. + * + * @return the inner object. + */ + SettingInner innerModel(); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SettingKind.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SettingKind.java new file mode 100644 index 000000000000..bd4f0da5001d --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SettingKind.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for SettingKind. */ +public final class SettingKind extends ExpandableStringEnum { + /** Static value DataExportSettings for SettingKind. */ + public static final SettingKind DATA_EXPORT_SETTINGS = fromString("DataExportSettings"); + + /** Static value AlertSuppressionSetting for SettingKind. */ + public static final SettingKind ALERT_SUPPRESSION_SETTING = fromString("AlertSuppressionSetting"); + + /** Static value AlertSyncSettings for SettingKind. */ + public static final SettingKind ALERT_SYNC_SETTINGS = fromString("AlertSyncSettings"); + + /** + * Creates or finds a SettingKind from its string representation. + * + * @param name a name to look for. + * @return the corresponding SettingKind. + */ + @JsonCreator + public static SettingKind fromString(String name) { + return fromString(name, SettingKind.class); + } + + /** @return known SettingKind values. */ + public static Collection values() { + return values(SettingKind.class); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Settings.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Settings.java new file mode 100644 index 000000000000..f9c10eed2292 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Settings.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.SettingInner; + +/** Resource collection API of Settings. */ +public interface Settings { + /** + * Settings about different configurations in security center. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return subscription settings list. + */ + PagedIterable list(); + + /** + * Settings about different configurations in security center. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return subscription settings list. + */ + PagedIterable list(Context context); + + /** + * Settings of different configurations in security center. + * + * @param settingName The name of the setting. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the kind of the security setting. + */ + Setting get(SettingsSettingName settingName); + + /** + * Settings of different configurations in security center. + * + * @param settingName The name of the setting. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the kind of the security setting. + */ + Response getWithResponse(SettingsSettingName settingName, Context context); + + /** + * updating settings about different configurations in security center. + * + * @param settingName The name of the setting. + * @param setting Setting object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the kind of the security setting. + */ + Setting update(SettingsSettingName settingName, SettingInner setting); + + /** + * updating settings about different configurations in security center. + * + * @param settingName The name of the setting. + * @param setting Setting object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the kind of the security setting. + */ + Response updateWithResponse(SettingsSettingName settingName, SettingInner setting, Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SettingsList.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SettingsList.java new file mode 100644 index 000000000000..223954c89b62 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SettingsList.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.models.SettingInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Subscription settings list. */ +@Fluent +public final class SettingsList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SettingsList.class); + + /* + * The settings list. + */ + @JsonProperty(value = "value") + private List value; + + /* + * The URI to fetch the next page. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: The settings list. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The settings list. + * + * @param value the value value to set. + * @return the SettingsList object itself. + */ + public SettingsList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The URI to fetch the next page. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SettingsSettingName.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SettingsSettingName.java new file mode 100644 index 000000000000..4660a0cb49d9 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SettingsSettingName.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for SettingsSettingName. */ +public final class SettingsSettingName extends ExpandableStringEnum { + /** Static value MCAS for SettingsSettingName. */ + public static final SettingsSettingName MCAS = fromString("MCAS"); + + /** Static value WDATP for SettingsSettingName. */ + public static final SettingsSettingName WDATP = fromString("WDATP"); + + /** Static value Sentinel for SettingsSettingName. */ + public static final SettingsSettingName SENTINEL = fromString("Sentinel"); + + /** + * Creates or finds a SettingsSettingName from its string representation. + * + * @param name a name to look for. + * @return the corresponding SettingsSettingName. + */ + @JsonCreator + public static SettingsSettingName fromString(String name) { + return fromString(name, SettingsSettingName.class); + } + + /** @return known SettingsSettingName values. */ + public static Collection values() { + return values(SettingsSettingName.class); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Severity.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Severity.java new file mode 100644 index 000000000000..b5f25f7314d6 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Severity.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for Severity. */ +public final class Severity extends ExpandableStringEnum { + /** Static value Low for Severity. */ + public static final Severity LOW = fromString("Low"); + + /** Static value Medium for Severity. */ + public static final Severity MEDIUM = fromString("Medium"); + + /** Static value High for Severity. */ + public static final Severity HIGH = fromString("High"); + + /** + * Creates or finds a Severity from its string representation. + * + * @param name a name to look for. + * @return the corresponding Severity. + */ + @JsonCreator + public static Severity fromString(String name) { + return fromString(name, Severity.class); + } + + /** @return known Severity values. */ + public static Collection values() { + return values(Severity.class); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Site.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Site.java new file mode 100644 index 000000000000..6d4491aa7c59 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Site.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Site data. */ +@Immutable +public final class Site { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Site.class); + + /* + * Site display name + */ + @JsonProperty(value = "displayName", access = JsonProperty.Access.WRITE_ONLY) + private String displayName; + + /** + * Get the displayName property: Site display name. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Software.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Software.java new file mode 100644 index 000000000000..9ff0d12a0d2a --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Software.java @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.resourcemanager.security.fluent.models.SoftwareInner; + +/** An immutable client-side representation of Software. */ +public interface Software { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the deviceId property: Unique identifier for the virtual machine in the service. + * + * @return the deviceId value. + */ + String deviceId(); + + /** + * Gets the osPlatform property: Platform of the operating system running on the device. + * + * @return the osPlatform value. + */ + String osPlatform(); + + /** + * Gets the vendor property: Name of the software vendor. + * + * @return the vendor value. + */ + String vendor(); + + /** + * Gets the softwareName property: Name of the software product. + * + * @return the softwareName value. + */ + String softwareName(); + + /** + * Gets the version property: Version number of the software product. + * + * @return the version value. + */ + String version(); + + /** + * Gets the endOfSupportStatus property: End of support status. + * + * @return the endOfSupportStatus value. + */ + EndOfSupportStatus endOfSupportStatus(); + + /** + * Gets the endOfSupportDate property: The end of support date in case the product is upcoming end of support. + * + * @return the endOfSupportDate value. + */ + String endOfSupportDate(); + + /** + * Gets the numberOfKnownVulnerabilities property: Number of weaknesses. + * + * @return the numberOfKnownVulnerabilities value. + */ + Integer numberOfKnownVulnerabilities(); + + /** + * Gets the firstSeenAt property: First time that the software was seen in the device. + * + * @return the firstSeenAt value. + */ + String firstSeenAt(); + + /** + * Gets the inner com.azure.resourcemanager.security.fluent.models.SoftwareInner object. + * + * @return the inner object. + */ + SoftwareInner innerModel(); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SoftwareInventories.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SoftwareInventories.java new file mode 100644 index 000000000000..76b5a5752831 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SoftwareInventories.java @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of SoftwareInventories. */ +public interface SoftwareInventories { + /** + * Gets the software inventory of the virtual machine. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param resourceNamespace The namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the software inventory of the virtual machine. + */ + PagedIterable listByExtendedResource( + String resourceGroupName, String resourceNamespace, String resourceType, String resourceName); + + /** + * Gets the software inventory of the virtual machine. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param resourceNamespace The namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the software inventory of the virtual machine. + */ + PagedIterable listByExtendedResource( + String resourceGroupName, String resourceNamespace, String resourceType, String resourceName, Context context); + + /** + * Gets the software inventory of all virtual machines in the subscriptions. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the software inventory of all virtual machines in the subscriptions. + */ + PagedIterable list(); + + /** + * Gets the software inventory of all virtual machines in the subscriptions. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the software inventory of all virtual machines in the subscriptions. + */ + PagedIterable list(Context context); + + /** + * Gets a single software data of the virtual machine. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param resourceNamespace The namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @param softwareName Name of the installed software. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a single software data of the virtual machine. + */ + Software get( + String resourceGroupName, + String resourceNamespace, + String resourceType, + String resourceName, + String softwareName); + + /** + * Gets a single software data of the virtual machine. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param resourceNamespace The namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @param softwareName Name of the installed software. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a single software data of the virtual machine. + */ + Response getWithResponse( + String resourceGroupName, + String resourceNamespace, + String resourceType, + String resourceName, + String softwareName, + Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SoftwaresList.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SoftwaresList.java new file mode 100644 index 000000000000..6bab7cde9123 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SoftwaresList.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.models.SoftwareInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Represents the software inventory of the virtual machine. */ +@Fluent +public final class SoftwaresList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SoftwaresList.class); + + /* + * The value property. + */ + @JsonProperty(value = "value") + private List value; + + /* + * The URI to fetch the next page. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: The value property. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The value property. + * + * @param value the value value to set. + * @return the SoftwaresList object itself. + */ + public SoftwaresList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The URI to fetch the next page. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Source.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Source.java new file mode 100644 index 000000000000..fa43237c7aa1 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Source.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for Source. */ +public final class Source extends ExpandableStringEnum { + /** Static value Azure for Source. */ + public static final Source AZURE = fromString("Azure"); + + /** Static value OnPremise for Source. */ + public static final Source ON_PREMISE = fromString("OnPremise"); + + /** Static value OnPremiseSql for Source. */ + public static final Source ON_PREMISE_SQL = fromString("OnPremiseSql"); + + /** + * Creates or finds a Source from its string representation. + * + * @param name a name to look for. + * @return the corresponding Source. + */ + @JsonCreator + public static Source fromString(String name) { + return fromString(name, Source.class); + } + + /** @return known Source values. */ + public static Collection values() { + return values(Source.class); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SourceSystem.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SourceSystem.java new file mode 100644 index 000000000000..0d2c53de8afc --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SourceSystem.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for SourceSystem. */ +public final class SourceSystem extends ExpandableStringEnum { + /** Static value Azure_AppLocker for SourceSystem. */ + public static final SourceSystem AZURE_APP_LOCKER = fromString("Azure_AppLocker"); + + /** Static value Azure_AuditD for SourceSystem. */ + public static final SourceSystem AZURE_AUDITD = fromString("Azure_AuditD"); + + /** Static value NonAzure_AppLocker for SourceSystem. */ + public static final SourceSystem NON_AZURE_APP_LOCKER = fromString("NonAzure_AppLocker"); + + /** Static value NonAzure_AuditD for SourceSystem. */ + public static final SourceSystem NON_AZURE_AUDITD = fromString("NonAzure_AuditD"); + + /** Static value None for SourceSystem. */ + public static final SourceSystem NONE = fromString("None"); + + /** + * Creates or finds a SourceSystem from its string representation. + * + * @param name a name to look for. + * @return the corresponding SourceSystem. + */ + @JsonCreator + public static SourceSystem fromString(String name) { + return fromString(name, SourceSystem.class); + } + + /** @return known SourceSystem values. */ + public static Collection values() { + return values(SourceSystem.class); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SqlServerVulnerabilityProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SqlServerVulnerabilityProperties.java new file mode 100644 index 000000000000..35b6814b2e04 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SqlServerVulnerabilityProperties.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** Details of the resource that was assessed. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "assessedResourceType") +@JsonTypeName("SqlServerVulnerability") +@Immutable +public final class SqlServerVulnerabilityProperties extends AdditionalData { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SqlServerVulnerabilityProperties.class); + + /* + * The resource type the sub assessment refers to in its resource details + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /* + * The T-SQL query that runs on your SQL database to perform the particular + * check + */ + @JsonProperty(value = "query", access = JsonProperty.Access.WRITE_ONLY) + private String query; + + /** + * Get the type property: The resource type the sub assessment refers to in its resource details. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Get the query property: The T-SQL query that runs on your SQL database to perform the particular check. + * + * @return the query value. + */ + public String query() { + return this.query; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SqlVulnerabilityAssessmentBaselineRules.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SqlVulnerabilityAssessmentBaselineRules.java new file mode 100644 index 000000000000..232e1ccddb26 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SqlVulnerabilityAssessmentBaselineRules.java @@ -0,0 +1,124 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of SqlVulnerabilityAssessmentBaselineRules. */ +public interface SqlVulnerabilityAssessmentBaselineRules { + /** + * Gets the results for a given rule in the Baseline. + * + * @param ruleId The rule Id. + * @param workspaceId The workspace Id. + * @param resourceId The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the results for a given rule in the Baseline. + */ + RuleResults get(String ruleId, String workspaceId, String resourceId); + + /** + * Gets the results for a given rule in the Baseline. + * + * @param ruleId The rule Id. + * @param workspaceId The workspace Id. + * @param resourceId The identifier of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the results for a given rule in the Baseline. + */ + Response getWithResponse(String ruleId, String workspaceId, String resourceId, Context context); + + /** + * Deletes a rule from the Baseline of a given database. + * + * @param ruleId The rule Id. + * @param workspaceId The workspace Id. + * @param resourceId The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String ruleId, String workspaceId, String resourceId); + + /** + * Deletes a rule from the Baseline of a given database. + * + * @param ruleId The rule Id. + * @param workspaceId The workspace Id. + * @param resourceId The identifier of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response deleteWithResponse(String ruleId, String workspaceId, String resourceId, Context context); + + /** + * Gets the results for all rules in the Baseline. + * + * @param workspaceId The workspace Id. + * @param resourceId The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the results for all rules in the Baseline. + */ + RulesResults list(String workspaceId, String resourceId); + + /** + * Gets the results for all rules in the Baseline. + * + * @param workspaceId The workspace Id. + * @param resourceId The identifier of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the results for all rules in the Baseline. + */ + Response listWithResponse(String workspaceId, String resourceId, Context context); + + /** + * Add a list of baseline rules. Will overwrite any previously existing results (for all rules). + * + * @param workspaceId The workspace Id. + * @param resourceId The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of rules results. + */ + RulesResults add(String workspaceId, String resourceId); + + /** + * Add a list of baseline rules. Will overwrite any previously existing results (for all rules). + * + * @param workspaceId The workspace Id. + * @param resourceId The identifier of the resource. + * @param body The baseline rules. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of rules results. + */ + Response addWithResponse( + String workspaceId, String resourceId, RulesResultsInput body, Context context); + + /** + * Begins definition for a new RuleResults resource. + * + * @param name resource name. + * @return the first stage of the new RuleResults definition. + */ + RuleResults.DefinitionStages.Blank define(String name); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SqlVulnerabilityAssessmentScanResults.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SqlVulnerabilityAssessmentScanResults.java new file mode 100644 index 000000000000..73818771c34a --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SqlVulnerabilityAssessmentScanResults.java @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of SqlVulnerabilityAssessmentScanResults. */ +public interface SqlVulnerabilityAssessmentScanResults { + /** + * Gets the scan results of a single rule in a scan record. + * + * @param scanId The scan Id. Type 'latest' to get the scan results for the latest scan. + * @param scanResultId The rule Id of the results. + * @param workspaceId The workspace Id. + * @param resourceId The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the scan results of a single rule in a scan record. + */ + ScanResult get(String scanId, String scanResultId, String workspaceId, String resourceId); + + /** + * Gets the scan results of a single rule in a scan record. + * + * @param scanId The scan Id. Type 'latest' to get the scan results for the latest scan. + * @param scanResultId The rule Id of the results. + * @param workspaceId The workspace Id. + * @param resourceId The identifier of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the scan results of a single rule in a scan record. + */ + Response getWithResponse( + String scanId, String scanResultId, String workspaceId, String resourceId, Context context); + + /** + * Gets a list of scan results for a single scan record. + * + * @param scanId The scan Id. Type 'latest' to get the scan results for the latest scan. + * @param workspaceId The workspace Id. + * @param resourceId The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of scan results for a single scan record. + */ + ScanResults list(String scanId, String workspaceId, String resourceId); + + /** + * Gets a list of scan results for a single scan record. + * + * @param scanId The scan Id. Type 'latest' to get the scan results for the latest scan. + * @param workspaceId The workspace Id. + * @param resourceId The identifier of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of scan results for a single scan record. + */ + Response listWithResponse(String scanId, String workspaceId, String resourceId, Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SqlVulnerabilityAssessmentScans.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SqlVulnerabilityAssessmentScans.java new file mode 100644 index 000000000000..69fadb720468 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SqlVulnerabilityAssessmentScans.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of SqlVulnerabilityAssessmentScans. */ +public interface SqlVulnerabilityAssessmentScans { + /** + * Gets the scan details of a single scan record. + * + * @param scanId The scan Id. Type 'latest' to get the scan record for the latest scan. + * @param workspaceId The workspace Id. + * @param resourceId The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the scan details of a single scan record. + */ + Scan get(String scanId, String workspaceId, String resourceId); + + /** + * Gets the scan details of a single scan record. + * + * @param scanId The scan Id. Type 'latest' to get the scan record for the latest scan. + * @param workspaceId The workspace Id. + * @param resourceId The identifier of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the scan details of a single scan record. + */ + Response getWithResponse(String scanId, String workspaceId, String resourceId, Context context); + + /** + * Gets a list of scan records. + * + * @param workspaceId The workspace Id. + * @param resourceId The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of scan records. + */ + Scans list(String workspaceId, String resourceId); + + /** + * Gets a list of scan records. + * + * @param workspaceId The workspace Id. + * @param resourceId The identifier of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of scan records. + */ + Response listWithResponse(String workspaceId, String resourceId, Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/State.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/State.java new file mode 100644 index 000000000000..e8d4812756c3 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/State.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for State. */ +public final class State extends ExpandableStringEnum { + /** Static value Passed for State. */ + public static final State PASSED = fromString("Passed"); + + /** Static value Failed for State. */ + public static final State FAILED = fromString("Failed"); + + /** Static value Skipped for State. */ + public static final State SKIPPED = fromString("Skipped"); + + /** Static value Unsupported for State. */ + public static final State UNSUPPORTED = fromString("Unsupported"); + + /** + * Creates or finds a State from its string representation. + * + * @param name a name to look for. + * @return the corresponding State. + */ + @JsonCreator + public static State fromString(String name) { + return fromString(name, State.class); + } + + /** @return known State values. */ + public static Collection values() { + return values(State.class); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Status.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Status.java new file mode 100644 index 000000000000..4efd8f98b5e1 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Status.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for Status. */ +public final class Status extends ExpandableStringEnum { + /** Static value Revoked for Status. */ + public static final Status REVOKED = fromString("Revoked"); + + /** Static value Initiated for Status. */ + public static final Status INITIATED = fromString("Initiated"); + + /** + * Creates or finds a Status from its string representation. + * + * @param name a name to look for. + * @return the corresponding Status. + */ + @JsonCreator + public static Status fromString(String name) { + return fromString(name, Status.class); + } + + /** @return known Status values. */ + public static Collection values() { + return values(Status.class); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/StatusReason.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/StatusReason.java new file mode 100644 index 000000000000..6cd949c58995 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/StatusReason.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for StatusReason. */ +public final class StatusReason extends ExpandableStringEnum { + /** Static value Expired for StatusReason. */ + public static final StatusReason EXPIRED = fromString("Expired"); + + /** Static value UserRequested for StatusReason. */ + public static final StatusReason USER_REQUESTED = fromString("UserRequested"); + + /** Static value NewerRequestInitiated for StatusReason. */ + public static final StatusReason NEWER_REQUEST_INITIATED = fromString("NewerRequestInitiated"); + + /** + * Creates or finds a StatusReason from its string representation. + * + * @param name a name to look for. + * @return the corresponding StatusReason. + */ + @JsonCreator + public static StatusReason fromString(String name) { + return fromString(name, StatusReason.class); + } + + /** @return known StatusReason values. */ + public static Collection values() { + return values(StatusReason.class); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SubAssessmentStatus.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SubAssessmentStatus.java new file mode 100644 index 000000000000..ca3a463c8881 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SubAssessmentStatus.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Status of the sub-assessment. */ +@Immutable +public final class SubAssessmentStatus { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SubAssessmentStatus.class); + + /* + * Programmatic code for the status of the assessment + */ + @JsonProperty(value = "code", access = JsonProperty.Access.WRITE_ONLY) + private SubAssessmentStatusCode code; + + /* + * Programmatic code for the cause of the assessment status + */ + @JsonProperty(value = "cause", access = JsonProperty.Access.WRITE_ONLY) + private String cause; + + /* + * Human readable description of the assessment status + */ + @JsonProperty(value = "description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /* + * The sub-assessment severity level + */ + @JsonProperty(value = "severity", access = JsonProperty.Access.WRITE_ONLY) + private Severity severity; + + /** + * Get the code property: Programmatic code for the status of the assessment. + * + * @return the code value. + */ + public SubAssessmentStatusCode code() { + return this.code; + } + + /** + * Get the cause property: Programmatic code for the cause of the assessment status. + * + * @return the cause value. + */ + public String cause() { + return this.cause; + } + + /** + * Get the description property: Human readable description of the assessment status. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Get the severity property: The sub-assessment severity level. + * + * @return the severity value. + */ + public Severity severity() { + return this.severity; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SubAssessmentStatusCode.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SubAssessmentStatusCode.java new file mode 100644 index 000000000000..1001d5f6d283 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SubAssessmentStatusCode.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for SubAssessmentStatusCode. */ +public final class SubAssessmentStatusCode extends ExpandableStringEnum { + /** Static value Healthy for SubAssessmentStatusCode. */ + public static final SubAssessmentStatusCode HEALTHY = fromString("Healthy"); + + /** Static value Unhealthy for SubAssessmentStatusCode. */ + public static final SubAssessmentStatusCode UNHEALTHY = fromString("Unhealthy"); + + /** Static value NotApplicable for SubAssessmentStatusCode. */ + public static final SubAssessmentStatusCode NOT_APPLICABLE = fromString("NotApplicable"); + + /** + * Creates or finds a SubAssessmentStatusCode from its string representation. + * + * @param name a name to look for. + * @return the corresponding SubAssessmentStatusCode. + */ + @JsonCreator + public static SubAssessmentStatusCode fromString(String name) { + return fromString(name, SubAssessmentStatusCode.class); + } + + /** @return known SubAssessmentStatusCode values. */ + public static Collection values() { + return values(SubAssessmentStatusCode.class); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SubAssessments.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SubAssessments.java new file mode 100644 index 000000000000..e403d453ce60 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SubAssessments.java @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of SubAssessments. */ +public interface SubAssessments { + /** + * Get security sub-assessments on all your scanned resources inside a subscription scope. + * + * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return security sub-assessments on all your scanned resources inside a subscription scope. + */ + PagedIterable listAll(String scope); + + /** + * Get security sub-assessments on all your scanned resources inside a subscription scope. + * + * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return security sub-assessments on all your scanned resources inside a subscription scope. + */ + PagedIterable listAll(String scope, Context context); + + /** + * Get security sub-assessments on all your scanned resources inside a scope. + * + * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @param assessmentName The Assessment Key - Unique key for the assessment type. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return security sub-assessments on all your scanned resources inside a scope. + */ + PagedIterable list(String scope, String assessmentName); + + /** + * Get security sub-assessments on all your scanned resources inside a scope. + * + * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @param assessmentName The Assessment Key - Unique key for the assessment type. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return security sub-assessments on all your scanned resources inside a scope. + */ + PagedIterable list(String scope, String assessmentName, Context context); + + /** + * Get a security sub-assessment on your scanned resource. + * + * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @param assessmentName The Assessment Key - Unique key for the assessment type. + * @param subAssessmentName The Sub-Assessment Key - Unique key for the sub-assessment type. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a security sub-assessment on your scanned resource. + */ + SecuritySubAssessment get(String scope, String assessmentName, String subAssessmentName); + + /** + * Get a security sub-assessment on your scanned resource. + * + * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @param assessmentName The Assessment Key - Unique key for the assessment type. + * @param subAssessmentName The Sub-Assessment Key - Unique key for the sub-assessment type. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a security sub-assessment on your scanned resource. + */ + Response getWithResponse( + String scope, String assessmentName, String subAssessmentName, Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SuppressionAlertsScope.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SuppressionAlertsScope.java new file mode 100644 index 000000000000..a75124f33299 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SuppressionAlertsScope.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The SuppressionAlertsScope model. */ +@Fluent +public final class SuppressionAlertsScope { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SuppressionAlertsScope.class); + + /* + * All the conditions inside need to be true in order to suppress the alert + */ + @JsonProperty(value = "allOf", required = true) + private List allOf; + + /** + * Get the allOf property: All the conditions inside need to be true in order to suppress the alert. + * + * @return the allOf value. + */ + public List allOf() { + return this.allOf; + } + + /** + * Set the allOf property: All the conditions inside need to be true in order to suppress the alert. + * + * @param allOf the allOf value to set. + * @return the SuppressionAlertsScope object itself. + */ + public SuppressionAlertsScope withAllOf(List allOf) { + this.allOf = allOf; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (allOf() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property allOf in model SuppressionAlertsScope")); + } else { + allOf().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Tags.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Tags.java new file mode 100644 index 000000000000..a9c96a8649d3 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Tags.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** A list of key value pairs that describe the resource. */ +@Fluent +public class Tags { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Tags.class); + + /* + * A list of key value pairs that describe the resource. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * Get the tags property: A list of key value pairs that describe the resource. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: A list of key value pairs that describe the resource. + * + * @param tags the tags value to set. + * @return the Tags object itself. + */ + public Tags withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/TagsResource.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/TagsResource.java new file mode 100644 index 000000000000..e9d9dedf0fe3 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/TagsResource.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** A container holding only the Tags for a resource, allowing the user to update the tags. */ +@Fluent +public class TagsResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TagsResource.class); + + /* + * Resource tags + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Resource tags. + * + * @param tags the tags value to set. + * @return the TagsResource object itself. + */ + public TagsResource withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Tasks.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Tasks.java new file mode 100644 index 000000000000..8c49508915a1 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Tasks.java @@ -0,0 +1,217 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of Tasks. */ +public interface Tasks { + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security task recommendations. + */ + PagedIterable list(); + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param filter OData filter. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security task recommendations. + */ + PagedIterable list(String filter, Context context); + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security task recommendations. + */ + PagedIterable listByHomeRegion(String ascLocation); + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param filter OData filter. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security task recommendations. + */ + PagedIterable listByHomeRegion(String ascLocation, String filter, Context context); + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param taskName Name of the task object, will be a GUID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return security task that we recommend to do in order to strengthen security. + */ + SecurityTask getSubscriptionLevelTask(String ascLocation, String taskName); + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param taskName Name of the task object, will be a GUID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return security task that we recommend to do in order to strengthen security. + */ + Response getSubscriptionLevelTaskWithResponse(String ascLocation, String taskName, Context context); + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param taskName Name of the task object, will be a GUID. + * @param taskUpdateActionType Type of the action to do on the task. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void updateSubscriptionLevelTaskState( + String ascLocation, String taskName, TasksTaskUpdateActionType taskUpdateActionType); + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param taskName Name of the task object, will be a GUID. + * @param taskUpdateActionType Type of the action to do on the task. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response updateSubscriptionLevelTaskStateWithResponse( + String ascLocation, String taskName, TasksTaskUpdateActionType taskUpdateActionType, Context context); + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security task recommendations. + */ + PagedIterable listByResourceGroup(String resourceGroupName, String ascLocation); + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param filter OData filter. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of security task recommendations. + */ + PagedIterable listByResourceGroup( + String resourceGroupName, String ascLocation, String filter, Context context); + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param taskName Name of the task object, will be a GUID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return security task that we recommend to do in order to strengthen security. + */ + SecurityTask getResourceGroupLevelTask(String resourceGroupName, String ascLocation, String taskName); + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param taskName Name of the task object, will be a GUID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return security task that we recommend to do in order to strengthen security. + */ + Response getResourceGroupLevelTaskWithResponse( + String resourceGroupName, String ascLocation, String taskName, Context context); + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param taskName Name of the task object, will be a GUID. + * @param taskUpdateActionType Type of the action to do on the task. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void updateResourceGroupLevelTaskState( + String resourceGroupName, String ascLocation, String taskName, TasksTaskUpdateActionType taskUpdateActionType); + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param taskName Name of the task object, will be a GUID. + * @param taskUpdateActionType Type of the action to do on the task. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response updateResourceGroupLevelTaskStateWithResponse( + String resourceGroupName, + String ascLocation, + String taskName, + TasksTaskUpdateActionType taskUpdateActionType, + Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/TasksTaskUpdateActionType.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/TasksTaskUpdateActionType.java new file mode 100644 index 000000000000..94abcf817de3 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/TasksTaskUpdateActionType.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for TasksTaskUpdateActionType. */ +public final class TasksTaskUpdateActionType extends ExpandableStringEnum { + /** Static value Activate for TasksTaskUpdateActionType. */ + public static final TasksTaskUpdateActionType ACTIVATE = fromString("Activate"); + + /** Static value Dismiss for TasksTaskUpdateActionType. */ + public static final TasksTaskUpdateActionType DISMISS = fromString("Dismiss"); + + /** Static value Start for TasksTaskUpdateActionType. */ + public static final TasksTaskUpdateActionType START = fromString("Start"); + + /** Static value Resolve for TasksTaskUpdateActionType. */ + public static final TasksTaskUpdateActionType RESOLVE = fromString("Resolve"); + + /** Static value Close for TasksTaskUpdateActionType. */ + public static final TasksTaskUpdateActionType CLOSE = fromString("Close"); + + /** + * Creates or finds a TasksTaskUpdateActionType from its string representation. + * + * @param name a name to look for. + * @return the corresponding TasksTaskUpdateActionType. + */ + @JsonCreator + public static TasksTaskUpdateActionType fromString(String name) { + return fromString(name, TasksTaskUpdateActionType.class); + } + + /** @return known TasksTaskUpdateActionType values. */ + public static Collection values() { + return values(TasksTaskUpdateActionType.class); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Threats.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Threats.java new file mode 100644 index 000000000000..e751e898dd00 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Threats.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for Threats. */ +public final class Threats extends ExpandableStringEnum { + /** Static value accountBreach for Threats. */ + public static final Threats ACCOUNT_BREACH = fromString("accountBreach"); + + /** Static value dataExfiltration for Threats. */ + public static final Threats DATA_EXFILTRATION = fromString("dataExfiltration"); + + /** Static value dataSpillage for Threats. */ + public static final Threats DATA_SPILLAGE = fromString("dataSpillage"); + + /** Static value maliciousInsider for Threats. */ + public static final Threats MALICIOUS_INSIDER = fromString("maliciousInsider"); + + /** Static value elevationOfPrivilege for Threats. */ + public static final Threats ELEVATION_OF_PRIVILEGE = fromString("elevationOfPrivilege"); + + /** Static value threatResistance for Threats. */ + public static final Threats THREAT_RESISTANCE = fromString("threatResistance"); + + /** Static value missingCoverage for Threats. */ + public static final Threats MISSING_COVERAGE = fromString("missingCoverage"); + + /** Static value denialOfService for Threats. */ + public static final Threats DENIAL_OF_SERVICE = fromString("denialOfService"); + + /** + * Creates or finds a Threats from its string representation. + * + * @param name a name to look for. + * @return the corresponding Threats. + */ + @JsonCreator + public static Threats fromString(String name) { + return fromString(name, Threats.class); + } + + /** @return known Threats values. */ + public static Collection values() { + return values(Threats.class); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ThresholdCustomAlertRule.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ThresholdCustomAlertRule.java new file mode 100644 index 000000000000..ac70f4cde09c --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ThresholdCustomAlertRule.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** A custom alert rule that checks if a value (depends on the custom alert type) is within the given range. */ +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "ruleType", + defaultImpl = ThresholdCustomAlertRule.class) +@JsonTypeName("ThresholdCustomAlertRule") +@JsonSubTypes({@JsonSubTypes.Type(name = "TimeWindowCustomAlertRule", value = TimeWindowCustomAlertRule.class)}) +@Fluent +public class ThresholdCustomAlertRule extends CustomAlertRule { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ThresholdCustomAlertRule.class); + + /* + * The minimum threshold. + */ + @JsonProperty(value = "minThreshold", required = true) + private int minThreshold; + + /* + * The maximum threshold. + */ + @JsonProperty(value = "maxThreshold", required = true) + private int maxThreshold; + + /** + * Get the minThreshold property: The minimum threshold. + * + * @return the minThreshold value. + */ + public int minThreshold() { + return this.minThreshold; + } + + /** + * Set the minThreshold property: The minimum threshold. + * + * @param minThreshold the minThreshold value to set. + * @return the ThresholdCustomAlertRule object itself. + */ + public ThresholdCustomAlertRule withMinThreshold(int minThreshold) { + this.minThreshold = minThreshold; + return this; + } + + /** + * Get the maxThreshold property: The maximum threshold. + * + * @return the maxThreshold value. + */ + public int maxThreshold() { + return this.maxThreshold; + } + + /** + * Set the maxThreshold property: The maximum threshold. + * + * @param maxThreshold the maxThreshold value to set. + * @return the ThresholdCustomAlertRule object itself. + */ + public ThresholdCustomAlertRule withMaxThreshold(int maxThreshold) { + this.maxThreshold = maxThreshold; + return this; + } + + /** {@inheritDoc} */ + @Override + public ThresholdCustomAlertRule withIsEnabled(boolean isEnabled) { + super.withIsEnabled(isEnabled); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/TiStatus.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/TiStatus.java new file mode 100644 index 000000000000..0d3223148878 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/TiStatus.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for TiStatus. */ +public final class TiStatus extends ExpandableStringEnum { + /** Static value Ok for TiStatus. */ + public static final TiStatus OK = fromString("Ok"); + + /** Static value Failed for TiStatus. */ + public static final TiStatus FAILED = fromString("Failed"); + + /** Static value InProgress for TiStatus. */ + public static final TiStatus IN_PROGRESS = fromString("InProgress"); + + /** Static value UpdateAvailable for TiStatus. */ + public static final TiStatus UPDATE_AVAILABLE = fromString("UpdateAvailable"); + + /** + * Creates or finds a TiStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding TiStatus. + */ + @JsonCreator + public static TiStatus fromString(String name) { + return fromString(name, TiStatus.class); + } + + /** @return known TiStatus values. */ + public static Collection values() { + return values(TiStatus.class); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/TimeWindowCustomAlertRule.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/TimeWindowCustomAlertRule.java new file mode 100644 index 000000000000..5314af1159c9 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/TimeWindowCustomAlertRule.java @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.time.Duration; + +/** + * A custom alert rule that checks if the number of activities (depends on the custom alert type) in a time window is + * within the given range. + */ +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "ruleType", + defaultImpl = TimeWindowCustomAlertRule.class) +@JsonTypeName("TimeWindowCustomAlertRule") +@JsonSubTypes({ + @JsonSubTypes.Type(name = "ActiveConnectionsNotInAllowedRange", value = ActiveConnectionsNotInAllowedRange.class), + @JsonSubTypes.Type(name = "AmqpC2DMessagesNotInAllowedRange", value = AmqpC2DMessagesNotInAllowedRange.class), + @JsonSubTypes.Type(name = "MqttC2DMessagesNotInAllowedRange", value = MqttC2DMessagesNotInAllowedRange.class), + @JsonSubTypes.Type(name = "HttpC2DMessagesNotInAllowedRange", value = HttpC2DMessagesNotInAllowedRange.class), + @JsonSubTypes.Type( + name = "AmqpC2DRejectedMessagesNotInAllowedRange", + value = AmqpC2DRejectedMessagesNotInAllowedRange.class), + @JsonSubTypes.Type( + name = "MqttC2DRejectedMessagesNotInAllowedRange", + value = MqttC2DRejectedMessagesNotInAllowedRange.class), + @JsonSubTypes.Type( + name = "HttpC2DRejectedMessagesNotInAllowedRange", + value = HttpC2DRejectedMessagesNotInAllowedRange.class), + @JsonSubTypes.Type(name = "AmqpD2CMessagesNotInAllowedRange", value = AmqpD2CMessagesNotInAllowedRange.class), + @JsonSubTypes.Type(name = "MqttD2CMessagesNotInAllowedRange", value = MqttD2CMessagesNotInAllowedRange.class), + @JsonSubTypes.Type(name = "HttpD2CMessagesNotInAllowedRange", value = HttpD2CMessagesNotInAllowedRange.class), + @JsonSubTypes.Type( + name = "DirectMethodInvokesNotInAllowedRange", + value = DirectMethodInvokesNotInAllowedRange.class), + @JsonSubTypes.Type(name = "FailedLocalLoginsNotInAllowedRange", value = FailedLocalLoginsNotInAllowedRange.class), + @JsonSubTypes.Type(name = "FileUploadsNotInAllowedRange", value = FileUploadsNotInAllowedRange.class), + @JsonSubTypes.Type(name = "QueuePurgesNotInAllowedRange", value = QueuePurgesNotInAllowedRange.class), + @JsonSubTypes.Type(name = "TwinUpdatesNotInAllowedRange", value = TwinUpdatesNotInAllowedRange.class), + @JsonSubTypes.Type( + name = "UnauthorizedOperationsNotInAllowedRange", + value = UnauthorizedOperationsNotInAllowedRange.class) +}) +@Fluent +public class TimeWindowCustomAlertRule extends ThresholdCustomAlertRule { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TimeWindowCustomAlertRule.class); + + /* + * The time window size in iso8601 format. + */ + @JsonProperty(value = "timeWindowSize", required = true) + private Duration timeWindowSize; + + /** + * Get the timeWindowSize property: The time window size in iso8601 format. + * + * @return the timeWindowSize value. + */ + public Duration timeWindowSize() { + return this.timeWindowSize; + } + + /** + * Set the timeWindowSize property: The time window size in iso8601 format. + * + * @param timeWindowSize the timeWindowSize value to set. + * @return the TimeWindowCustomAlertRule object itself. + */ + public TimeWindowCustomAlertRule withTimeWindowSize(Duration timeWindowSize) { + this.timeWindowSize = timeWindowSize; + return this; + } + + /** {@inheritDoc} */ + @Override + public TimeWindowCustomAlertRule withMinThreshold(int minThreshold) { + super.withMinThreshold(minThreshold); + return this; + } + + /** {@inheritDoc} */ + @Override + public TimeWindowCustomAlertRule withMaxThreshold(int maxThreshold) { + super.withMaxThreshold(maxThreshold); + return this; + } + + /** {@inheritDoc} */ + @Override + public TimeWindowCustomAlertRule withIsEnabled(boolean isEnabled) { + super.withIsEnabled(isEnabled); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (timeWindowSize() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property timeWindowSize in model TimeWindowCustomAlertRule")); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Topologies.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Topologies.java new file mode 100644 index 000000000000..471558133393 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Topologies.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of Topologies. */ +public interface Topologies { + /** + * Gets a list that allows to build a topology view of a subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list that allows to build a topology view of a subscription. + */ + PagedIterable list(); + + /** + * Gets a list that allows to build a topology view of a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list that allows to build a topology view of a subscription. + */ + PagedIterable list(Context context); + + /** + * Gets a list that allows to build a topology view of a subscription and location. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list that allows to build a topology view of a subscription and location. + */ + PagedIterable listByHomeRegion(String ascLocation); + + /** + * Gets a list that allows to build a topology view of a subscription and location. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list that allows to build a topology view of a subscription and location. + */ + PagedIterable listByHomeRegion(String ascLocation, Context context); + + /** + * Gets a specific topology component. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param topologyResourceName Name of a topology resources collection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a specific topology component. + */ + TopologyResource get(String resourceGroupName, String ascLocation, String topologyResourceName); + + /** + * Gets a specific topology component. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param topologyResourceName Name of a topology resources collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a specific topology component. + */ + Response getWithResponse( + String resourceGroupName, String ascLocation, String topologyResourceName, Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/TopologyList.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/TopologyList.java new file mode 100644 index 000000000000..3c3a77f6b2d0 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/TopologyList.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.models.TopologyResourceInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The TopologyList model. */ +@Immutable +public final class TopologyList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TopologyList.class); + + /* + * The value property. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * The URI to fetch the next page. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: The value property. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The URI to fetch the next page. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/TopologyResource.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/TopologyResource.java new file mode 100644 index 000000000000..0621d4ce55dd --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/TopologyResource.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.resourcemanager.security.fluent.models.TopologyResourceInner; +import java.time.OffsetDateTime; +import java.util.List; + +/** An immutable client-side representation of TopologyResource. */ +public interface TopologyResource { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the calculatedDateTime property: The UTC time on which the topology was calculated. + * + * @return the calculatedDateTime value. + */ + OffsetDateTime calculatedDateTime(); + + /** + * Gets the topologyResources property: Azure resources which are part of this topology resource. + * + * @return the topologyResources value. + */ + List topologyResources(); + + /** + * Gets the location property: Location where the resource is stored. + * + * @return the location value. + */ + String location(); + + /** + * Gets the inner com.azure.resourcemanager.security.fluent.models.TopologyResourceInner object. + * + * @return the inner object. + */ + TopologyResourceInner innerModel(); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/TopologySingleResource.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/TopologySingleResource.java new file mode 100644 index 000000000000..07b01e1b61a0 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/TopologySingleResource.java @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The TopologySingleResource model. */ +@Immutable +public final class TopologySingleResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TopologySingleResource.class); + + /* + * Azure resource id + */ + @JsonProperty(value = "resourceId", access = JsonProperty.Access.WRITE_ONLY) + private String resourceId; + + /* + * The security severity of the resource + */ + @JsonProperty(value = "severity", access = JsonProperty.Access.WRITE_ONLY) + private String severity; + + /* + * Indicates if the resource has security recommendations + */ + @JsonProperty(value = "recommendationsExist", access = JsonProperty.Access.WRITE_ONLY) + private Boolean recommendationsExist; + + /* + * Indicates the resource connectivity level to the Internet + * (InternetFacing, Internal ,etc.) + */ + @JsonProperty(value = "networkZones", access = JsonProperty.Access.WRITE_ONLY) + private String networkZones; + + /* + * Score of the resource based on its security severity + */ + @JsonProperty(value = "topologyScore", access = JsonProperty.Access.WRITE_ONLY) + private Integer topologyScore; + + /* + * The location of this resource + */ + @JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY) + private String location; + + /* + * Azure resources connected to this resource which are in higher level in + * the topology view + */ + @JsonProperty(value = "parents", access = JsonProperty.Access.WRITE_ONLY) + private List parents; + + /* + * Azure resources connected to this resource which are in lower level in + * the topology view + */ + @JsonProperty(value = "children", access = JsonProperty.Access.WRITE_ONLY) + private List children; + + /** + * Get the resourceId property: Azure resource id. + * + * @return the resourceId value. + */ + public String resourceId() { + return this.resourceId; + } + + /** + * Get the severity property: The security severity of the resource. + * + * @return the severity value. + */ + public String severity() { + return this.severity; + } + + /** + * Get the recommendationsExist property: Indicates if the resource has security recommendations. + * + * @return the recommendationsExist value. + */ + public Boolean recommendationsExist() { + return this.recommendationsExist; + } + + /** + * Get the networkZones property: Indicates the resource connectivity level to the Internet (InternetFacing, + * Internal ,etc.). + * + * @return the networkZones value. + */ + public String networkZones() { + return this.networkZones; + } + + /** + * Get the topologyScore property: Score of the resource based on its security severity. + * + * @return the topologyScore value. + */ + public Integer topologyScore() { + return this.topologyScore; + } + + /** + * Get the location property: The location of this resource. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Get the parents property: Azure resources connected to this resource which are in higher level in the topology + * view. + * + * @return the parents value. + */ + public List parents() { + return this.parents; + } + + /** + * Get the children property: Azure resources connected to this resource which are in lower level in the topology + * view. + * + * @return the children value. + */ + public List children() { + return this.children; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (parents() != null) { + parents().forEach(e -> e.validate()); + } + if (children() != null) { + children().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/TopologySingleResourceChild.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/TopologySingleResourceChild.java new file mode 100644 index 000000000000..c1fb5c9a52fb --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/TopologySingleResourceChild.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The TopologySingleResourceChild model. */ +@Immutable +public final class TopologySingleResourceChild { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TopologySingleResourceChild.class); + + /* + * Azure resource id which serves as child resource in topology view + */ + @JsonProperty(value = "resourceId", access = JsonProperty.Access.WRITE_ONLY) + private String resourceId; + + /** + * Get the resourceId property: Azure resource id which serves as child resource in topology view. + * + * @return the resourceId value. + */ + public String resourceId() { + return this.resourceId; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/TopologySingleResourceParent.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/TopologySingleResourceParent.java new file mode 100644 index 000000000000..f76dd76afc24 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/TopologySingleResourceParent.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The TopologySingleResourceParent model. */ +@Immutable +public final class TopologySingleResourceParent { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TopologySingleResourceParent.class); + + /* + * Azure resource id which serves as parent resource in topology view + */ + @JsonProperty(value = "resourceId", access = JsonProperty.Access.WRITE_ONLY) + private String resourceId; + + /** + * Get the resourceId property: Azure resource id which serves as parent resource in topology view. + * + * @return the resourceId value. + */ + public String resourceId() { + return this.resourceId; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/TrackedResource.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/TrackedResource.java new file mode 100644 index 000000000000..4d48619621c0 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/TrackedResource.java @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Describes an Azure tracked resource. */ +@Fluent +public final class TrackedResource extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TrackedResource.class); + + /* + * Location where the resource is stored + */ + @JsonProperty(value = "location") + private String location; + + /* + * Kind of the resource + */ + @JsonProperty(value = "kind") + private String kind; + + /* + * Entity tag is used for comparing two or more entities from the same + * requested resource. + */ + @JsonProperty(value = "etag") + private String etag; + + /* + * A list of key value pairs that describe the resource. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * Get the location property: Location where the resource is stored. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: Location where the resource is stored. + * + * @param location the location value to set. + * @return the TrackedResource object itself. + */ + public TrackedResource withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the kind property: Kind of the resource. + * + * @return the kind value. + */ + public String kind() { + return this.kind; + } + + /** + * Set the kind property: Kind of the resource. + * + * @param kind the kind value to set. + * @return the TrackedResource object itself. + */ + public TrackedResource withKind(String kind) { + this.kind = kind; + return this; + } + + /** + * Get the etag property: Entity tag is used for comparing two or more entities from the same requested resource. + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** + * Set the etag property: Entity tag is used for comparing two or more entities from the same requested resource. + * + * @param etag the etag value to set. + * @return the TrackedResource object itself. + */ + public TrackedResource withEtag(String etag) { + this.etag = etag; + return this; + } + + /** + * Get the tags property: A list of key value pairs that describe the resource. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: A list of key value pairs that describe the resource. + * + * @param tags the tags value to set. + * @return the TrackedResource object itself. + */ + public TrackedResource withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/TransportProtocol.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/TransportProtocol.java new file mode 100644 index 000000000000..22b4f8178be0 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/TransportProtocol.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for TransportProtocol. */ +public final class TransportProtocol extends ExpandableStringEnum { + /** Static value TCP for TransportProtocol. */ + public static final TransportProtocol TCP = fromString("TCP"); + + /** Static value UDP for TransportProtocol. */ + public static final TransportProtocol UDP = fromString("UDP"); + + /** + * Creates or finds a TransportProtocol from its string representation. + * + * @param name a name to look for. + * @return the corresponding TransportProtocol. + */ + @JsonCreator + public static TransportProtocol fromString(String name) { + return fromString(name, TransportProtocol.class); + } + + /** @return known TransportProtocol values. */ + public static Collection values() { + return values(TransportProtocol.class); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/TwinUpdatesNotInAllowedRange.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/TwinUpdatesNotInAllowedRange.java new file mode 100644 index 000000000000..e53e3322268f --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/TwinUpdatesNotInAllowedRange.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.time.Duration; + +/** Number of twin updates is not in allowed range. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "ruleType") +@JsonTypeName("TwinUpdatesNotInAllowedRange") +@Fluent +public final class TwinUpdatesNotInAllowedRange extends TimeWindowCustomAlertRule { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TwinUpdatesNotInAllowedRange.class); + + /** {@inheritDoc} */ + @Override + public TwinUpdatesNotInAllowedRange withTimeWindowSize(Duration timeWindowSize) { + super.withTimeWindowSize(timeWindowSize); + return this; + } + + /** {@inheritDoc} */ + @Override + public TwinUpdatesNotInAllowedRange withMinThreshold(int minThreshold) { + super.withMinThreshold(minThreshold); + return this; + } + + /** {@inheritDoc} */ + @Override + public TwinUpdatesNotInAllowedRange withMaxThreshold(int maxThreshold) { + super.withMaxThreshold(maxThreshold); + return this; + } + + /** {@inheritDoc} */ + @Override + public TwinUpdatesNotInAllowedRange withIsEnabled(boolean isEnabled) { + super.withIsEnabled(isEnabled); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/UnauthorizedOperationsNotInAllowedRange.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/UnauthorizedOperationsNotInAllowedRange.java new file mode 100644 index 000000000000..4ae9731f4426 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/UnauthorizedOperationsNotInAllowedRange.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.time.Duration; + +/** Number of unauthorized operations is not in allowed range. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "ruleType") +@JsonTypeName("UnauthorizedOperationsNotInAllowedRange") +@Fluent +public final class UnauthorizedOperationsNotInAllowedRange extends TimeWindowCustomAlertRule { + @JsonIgnore private final ClientLogger logger = new ClientLogger(UnauthorizedOperationsNotInAllowedRange.class); + + /** {@inheritDoc} */ + @Override + public UnauthorizedOperationsNotInAllowedRange withTimeWindowSize(Duration timeWindowSize) { + super.withTimeWindowSize(timeWindowSize); + return this; + } + + /** {@inheritDoc} */ + @Override + public UnauthorizedOperationsNotInAllowedRange withMinThreshold(int minThreshold) { + super.withMinThreshold(minThreshold); + return this; + } + + /** {@inheritDoc} */ + @Override + public UnauthorizedOperationsNotInAllowedRange withMaxThreshold(int maxThreshold) { + super.withMaxThreshold(maxThreshold); + return this; + } + + /** {@inheritDoc} */ + @Override + public UnauthorizedOperationsNotInAllowedRange withIsEnabled(boolean isEnabled) { + super.withIsEnabled(isEnabled); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/UnmaskedIpLoggingStatus.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/UnmaskedIpLoggingStatus.java new file mode 100644 index 000000000000..bbb33244cdb3 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/UnmaskedIpLoggingStatus.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for UnmaskedIpLoggingStatus. */ +public final class UnmaskedIpLoggingStatus extends ExpandableStringEnum { + /** Static value Disabled for UnmaskedIpLoggingStatus. */ + public static final UnmaskedIpLoggingStatus DISABLED = fromString("Disabled"); + + /** Static value Enabled for UnmaskedIpLoggingStatus. */ + public static final UnmaskedIpLoggingStatus ENABLED = fromString("Enabled"); + + /** + * Creates or finds a UnmaskedIpLoggingStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding UnmaskedIpLoggingStatus. + */ + @JsonCreator + public static UnmaskedIpLoggingStatus fromString(String name) { + return fromString(name, UnmaskedIpLoggingStatus.class); + } + + /** @return known UnmaskedIpLoggingStatus values. */ + public static Collection values() { + return values(UnmaskedIpLoggingStatus.class); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/UpdateIotSecuritySolutionData.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/UpdateIotSecuritySolutionData.java new file mode 100644 index 000000000000..5000ac37c634 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/UpdateIotSecuritySolutionData.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** The UpdateIotSecuritySolutionData model. */ +@JsonFlatten +@Fluent +public class UpdateIotSecuritySolutionData extends TagsResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(UpdateIotSecuritySolutionData.class); + + /* + * Properties of the IoT Security solution's user defined resources. + */ + @JsonProperty(value = "properties.userDefinedResources") + private UserDefinedResourcesProperties userDefinedResources; + + /* + * List of the configuration status for each recommendation type. + */ + @JsonProperty(value = "properties.recommendationsConfiguration") + private List recommendationsConfiguration; + + /** + * Get the userDefinedResources property: Properties of the IoT Security solution's user defined resources. + * + * @return the userDefinedResources value. + */ + public UserDefinedResourcesProperties userDefinedResources() { + return this.userDefinedResources; + } + + /** + * Set the userDefinedResources property: Properties of the IoT Security solution's user defined resources. + * + * @param userDefinedResources the userDefinedResources value to set. + * @return the UpdateIotSecuritySolutionData object itself. + */ + public UpdateIotSecuritySolutionData withUserDefinedResources(UserDefinedResourcesProperties userDefinedResources) { + this.userDefinedResources = userDefinedResources; + return this; + } + + /** + * Get the recommendationsConfiguration property: List of the configuration status for each recommendation type. + * + * @return the recommendationsConfiguration value. + */ + public List recommendationsConfiguration() { + return this.recommendationsConfiguration; + } + + /** + * Set the recommendationsConfiguration property: List of the configuration status for each recommendation type. + * + * @param recommendationsConfiguration the recommendationsConfiguration value to set. + * @return the UpdateIotSecuritySolutionData object itself. + */ + public UpdateIotSecuritySolutionData withRecommendationsConfiguration( + List recommendationsConfiguration) { + this.recommendationsConfiguration = recommendationsConfiguration; + return this; + } + + /** {@inheritDoc} */ + @Override + public UpdateIotSecuritySolutionData withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (userDefinedResources() != null) { + userDefinedResources().validate(); + } + if (recommendationsConfiguration() != null) { + recommendationsConfiguration().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/UpgradePackageDownloadInfo.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/UpgradePackageDownloadInfo.java new file mode 100644 index 000000000000..db2cd7bf0f18 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/UpgradePackageDownloadInfo.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Information on a specific package upgrade download. */ +@Immutable +public final class UpgradePackageDownloadInfo extends PackageDownloadInfo { + @JsonIgnore private final ClientLogger logger = new ClientLogger(UpgradePackageDownloadInfo.class); + + /* + * Minimum base version for upgrade + */ + @JsonProperty(value = "fromVersion", access = JsonProperty.Access.WRITE_ONLY) + private String fromVersion; + + /** + * Get the fromVersion property: Minimum base version for upgrade. + * + * @return the fromVersion value. + */ + public String fromVersion() { + return this.fromVersion; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/UserDefinedResourcesProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/UserDefinedResourcesProperties.java new file mode 100644 index 000000000000..ab8fa0f8c049 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/UserDefinedResourcesProperties.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Properties of the IoT Security solution's user defined resources. */ +@Fluent +public final class UserDefinedResourcesProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(UserDefinedResourcesProperties.class); + + /* + * Azure Resource Graph query which represents the security solution's user + * defined resources. Required to start with "where type != + * "Microsoft.Devices/IotHubs"" + */ + @JsonProperty(value = "query", required = true) + private String query; + + /* + * List of Azure subscription ids on which the user defined resources query + * should be executed. + */ + @JsonProperty(value = "querySubscriptions", required = true) + private List querySubscriptions; + + /** + * Get the query property: Azure Resource Graph query which represents the security solution's user defined + * resources. Required to start with "where type != "Microsoft.Devices/IotHubs"". + * + * @return the query value. + */ + public String query() { + return this.query; + } + + /** + * Set the query property: Azure Resource Graph query which represents the security solution's user defined + * resources. Required to start with "where type != "Microsoft.Devices/IotHubs"". + * + * @param query the query value to set. + * @return the UserDefinedResourcesProperties object itself. + */ + public UserDefinedResourcesProperties withQuery(String query) { + this.query = query; + return this; + } + + /** + * Get the querySubscriptions property: List of Azure subscription ids on which the user defined resources query + * should be executed. + * + * @return the querySubscriptions value. + */ + public List querySubscriptions() { + return this.querySubscriptions; + } + + /** + * Set the querySubscriptions property: List of Azure subscription ids on which the user defined resources query + * should be executed. + * + * @param querySubscriptions the querySubscriptions value to set. + * @return the UserDefinedResourcesProperties object itself. + */ + public UserDefinedResourcesProperties withQuerySubscriptions(List querySubscriptions) { + this.querySubscriptions = querySubscriptions; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (query() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property query in model UserDefinedResourcesProperties")); + } + if (querySubscriptions() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property querySubscriptions in model UserDefinedResourcesProperties")); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/UserImpact.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/UserImpact.java new file mode 100644 index 000000000000..62a816bdfbfc --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/UserImpact.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for UserImpact. */ +public final class UserImpact extends ExpandableStringEnum { + /** Static value Low for UserImpact. */ + public static final UserImpact LOW = fromString("Low"); + + /** Static value Moderate for UserImpact. */ + public static final UserImpact MODERATE = fromString("Moderate"); + + /** Static value High for UserImpact. */ + public static final UserImpact HIGH = fromString("High"); + + /** + * Creates or finds a UserImpact from its string representation. + * + * @param name a name to look for. + * @return the corresponding UserImpact. + */ + @JsonCreator + public static UserImpact fromString(String name) { + return fromString(name, UserImpact.class); + } + + /** @return known UserImpact values. */ + public static Collection values() { + return values(UserImpact.class); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/UserRecommendation.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/UserRecommendation.java new file mode 100644 index 000000000000..785219f3045e --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/UserRecommendation.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Represents a user that is recommended to be allowed for a certain rule. */ +@Fluent +public final class UserRecommendation { + @JsonIgnore private final ClientLogger logger = new ClientLogger(UserRecommendation.class); + + /* + * Represents a user that is recommended to be allowed for a certain rule + */ + @JsonProperty(value = "username") + private String username; + + /* + * The recommendation action of the machine or rule + */ + @JsonProperty(value = "recommendationAction") + private RecommendationAction recommendationAction; + + /** + * Get the username property: Represents a user that is recommended to be allowed for a certain rule. + * + * @return the username value. + */ + public String username() { + return this.username; + } + + /** + * Set the username property: Represents a user that is recommended to be allowed for a certain rule. + * + * @param username the username value to set. + * @return the UserRecommendation object itself. + */ + public UserRecommendation withUsername(String username) { + this.username = username; + return this; + } + + /** + * Get the recommendationAction property: The recommendation action of the machine or rule. + * + * @return the recommendationAction value. + */ + public RecommendationAction recommendationAction() { + return this.recommendationAction; + } + + /** + * Set the recommendationAction property: The recommendation action of the machine or rule. + * + * @param recommendationAction the recommendationAction value to set. + * @return the UserRecommendation object itself. + */ + public UserRecommendation withRecommendationAction(RecommendationAction recommendationAction) { + this.recommendationAction = recommendationAction; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/VaRule.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/VaRule.java new file mode 100644 index 000000000000..5e844680a329 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/VaRule.java @@ -0,0 +1,265 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** vulnerability assessment rule metadata details. */ +@Fluent +public final class VaRule { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VaRule.class); + + /* + * The rule Id. + */ + @JsonProperty(value = "ruleId") + private String ruleId; + + /* + * The rule severity. + */ + @JsonProperty(value = "severity") + private RuleSeverity severity; + + /* + * The rule category. + */ + @JsonProperty(value = "category") + private String category; + + /* + * The rule type. + */ + @JsonProperty(value = "ruleType") + private RuleType ruleType; + + /* + * The rule title. + */ + @JsonProperty(value = "title") + private String title; + + /* + * The rule description. + */ + @JsonProperty(value = "description") + private String description; + + /* + * The rule rationale. + */ + @JsonProperty(value = "rationale") + private String rationale; + + /* + * The rule query details. + */ + @JsonProperty(value = "queryCheck") + private QueryCheck queryCheck; + + /* + * The benchmark references. + */ + @JsonProperty(value = "benchmarkReferences") + private List benchmarkReferences; + + /** + * Get the ruleId property: The rule Id. + * + * @return the ruleId value. + */ + public String ruleId() { + return this.ruleId; + } + + /** + * Set the ruleId property: The rule Id. + * + * @param ruleId the ruleId value to set. + * @return the VaRule object itself. + */ + public VaRule withRuleId(String ruleId) { + this.ruleId = ruleId; + return this; + } + + /** + * Get the severity property: The rule severity. + * + * @return the severity value. + */ + public RuleSeverity severity() { + return this.severity; + } + + /** + * Set the severity property: The rule severity. + * + * @param severity the severity value to set. + * @return the VaRule object itself. + */ + public VaRule withSeverity(RuleSeverity severity) { + this.severity = severity; + return this; + } + + /** + * Get the category property: The rule category. + * + * @return the category value. + */ + public String category() { + return this.category; + } + + /** + * Set the category property: The rule category. + * + * @param category the category value to set. + * @return the VaRule object itself. + */ + public VaRule withCategory(String category) { + this.category = category; + return this; + } + + /** + * Get the ruleType property: The rule type. + * + * @return the ruleType value. + */ + public RuleType ruleType() { + return this.ruleType; + } + + /** + * Set the ruleType property: The rule type. + * + * @param ruleType the ruleType value to set. + * @return the VaRule object itself. + */ + public VaRule withRuleType(RuleType ruleType) { + this.ruleType = ruleType; + return this; + } + + /** + * Get the title property: The rule title. + * + * @return the title value. + */ + public String title() { + return this.title; + } + + /** + * Set the title property: The rule title. + * + * @param title the title value to set. + * @return the VaRule object itself. + */ + public VaRule withTitle(String title) { + this.title = title; + return this; + } + + /** + * Get the description property: The rule description. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: The rule description. + * + * @param description the description value to set. + * @return the VaRule object itself. + */ + public VaRule withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the rationale property: The rule rationale. + * + * @return the rationale value. + */ + public String rationale() { + return this.rationale; + } + + /** + * Set the rationale property: The rule rationale. + * + * @param rationale the rationale value to set. + * @return the VaRule object itself. + */ + public VaRule withRationale(String rationale) { + this.rationale = rationale; + return this; + } + + /** + * Get the queryCheck property: The rule query details. + * + * @return the queryCheck value. + */ + public QueryCheck queryCheck() { + return this.queryCheck; + } + + /** + * Set the queryCheck property: The rule query details. + * + * @param queryCheck the queryCheck value to set. + * @return the VaRule object itself. + */ + public VaRule withQueryCheck(QueryCheck queryCheck) { + this.queryCheck = queryCheck; + return this; + } + + /** + * Get the benchmarkReferences property: The benchmark references. + * + * @return the benchmarkReferences value. + */ + public List benchmarkReferences() { + return this.benchmarkReferences; + } + + /** + * Set the benchmarkReferences property: The benchmark references. + * + * @param benchmarkReferences the benchmarkReferences value to set. + * @return the VaRule object itself. + */ + public VaRule withBenchmarkReferences(List benchmarkReferences) { + this.benchmarkReferences = benchmarkReferences; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (queryCheck() != null) { + queryCheck().validate(); + } + if (benchmarkReferences() != null) { + benchmarkReferences().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ValueType.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ValueType.java new file mode 100644 index 000000000000..b2d710e7a108 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ValueType.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ValueType. */ +public final class ValueType extends ExpandableStringEnum { + /** Static value IpCidr for ValueType. */ + public static final ValueType IP_CIDR = fromString("IpCidr"); + + /** Static value String for ValueType. */ + public static final ValueType STRING = fromString("String"); + + /** + * Creates or finds a ValueType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ValueType. + */ + @JsonCreator + public static ValueType fromString(String name) { + return fromString(name, ValueType.class); + } + + /** @return known ValueType values. */ + public static Collection values() { + return values(ValueType.class); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/VendorReference.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/VendorReference.java new file mode 100644 index 000000000000..f02243573ae7 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/VendorReference.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Vendor reference. */ +@Immutable +public final class VendorReference { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VendorReference.class); + + /* + * Link title + */ + @JsonProperty(value = "title", access = JsonProperty.Access.WRITE_ONLY) + private String title; + + /* + * Link url + */ + @JsonProperty(value = "link", access = JsonProperty.Access.WRITE_ONLY) + private String link; + + /** + * Get the title property: Link title. + * + * @return the title value. + */ + public String title() { + return this.title; + } + + /** + * Get the link property: Link url. + * + * @return the link value. + */ + public String link() { + return this.link; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/VersionKind.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/VersionKind.java new file mode 100644 index 000000000000..d367dff7a628 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/VersionKind.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for VersionKind. */ +public final class VersionKind extends ExpandableStringEnum { + /** Static value Latest for VersionKind. */ + public static final VersionKind LATEST = fromString("Latest"); + + /** Static value Previous for VersionKind. */ + public static final VersionKind PREVIOUS = fromString("Previous"); + + /** Static value Preview for VersionKind. */ + public static final VersionKind PREVIEW = fromString("Preview"); + + /** + * Creates or finds a VersionKind from its string representation. + * + * @param name a name to look for. + * @return the corresponding VersionKind. + */ + @JsonCreator + public static VersionKind fromString(String name) { + return fromString(name, VersionKind.class); + } + + /** @return known VersionKind values. */ + public static Collection values() { + return values(VersionKind.class); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/VmRecommendation.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/VmRecommendation.java new file mode 100644 index 000000000000..5321771475f6 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/VmRecommendation.java @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Represents a machine that is part of a machine group. */ +@Fluent +public final class VmRecommendation { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VmRecommendation.class); + + /* + * The configuration status of the machines group or machine or rule + */ + @JsonProperty(value = "configurationStatus") + private ConfigurationStatus configurationStatus; + + /* + * The recommendation action of the machine or rule + */ + @JsonProperty(value = "recommendationAction") + private RecommendationAction recommendationAction; + + /* + * The full resource id of the machine + */ + @JsonProperty(value = "resourceId") + private String resourceId; + + /* + * The machine supportability of Enforce feature + */ + @JsonProperty(value = "enforcementSupport") + private EnforcementSupport enforcementSupport; + + /** + * Get the configurationStatus property: The configuration status of the machines group or machine or rule. + * + * @return the configurationStatus value. + */ + public ConfigurationStatus configurationStatus() { + return this.configurationStatus; + } + + /** + * Set the configurationStatus property: The configuration status of the machines group or machine or rule. + * + * @param configurationStatus the configurationStatus value to set. + * @return the VmRecommendation object itself. + */ + public VmRecommendation withConfigurationStatus(ConfigurationStatus configurationStatus) { + this.configurationStatus = configurationStatus; + return this; + } + + /** + * Get the recommendationAction property: The recommendation action of the machine or rule. + * + * @return the recommendationAction value. + */ + public RecommendationAction recommendationAction() { + return this.recommendationAction; + } + + /** + * Set the recommendationAction property: The recommendation action of the machine or rule. + * + * @param recommendationAction the recommendationAction value to set. + * @return the VmRecommendation object itself. + */ + public VmRecommendation withRecommendationAction(RecommendationAction recommendationAction) { + this.recommendationAction = recommendationAction; + return this; + } + + /** + * Get the resourceId property: The full resource id of the machine. + * + * @return the resourceId value. + */ + public String resourceId() { + return this.resourceId; + } + + /** + * Set the resourceId property: The full resource id of the machine. + * + * @param resourceId the resourceId value to set. + * @return the VmRecommendation object itself. + */ + public VmRecommendation withResourceId(String resourceId) { + this.resourceId = resourceId; + return this; + } + + /** + * Get the enforcementSupport property: The machine supportability of Enforce feature. + * + * @return the enforcementSupport value. + */ + public EnforcementSupport enforcementSupport() { + return this.enforcementSupport; + } + + /** + * Set the enforcementSupport property: The machine supportability of Enforce feature. + * + * @param enforcementSupport the enforcementSupport value to set. + * @return the VmRecommendation object itself. + */ + public VmRecommendation withEnforcementSupport(EnforcementSupport enforcementSupport) { + this.enforcementSupport = enforcementSupport; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/WorkspaceSetting.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/WorkspaceSetting.java new file mode 100644 index 000000000000..c6b7717a0ce0 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/WorkspaceSetting.java @@ -0,0 +1,169 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.WorkspaceSettingInner; + +/** An immutable client-side representation of WorkspaceSetting. */ +public interface WorkspaceSetting { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the workspaceId property: The full Azure ID of the workspace to save the data in. + * + * @return the workspaceId value. + */ + String workspaceId(); + + /** + * Gets the scope property: All the VMs in this scope will send their security data to the mentioned workspace + * unless overridden by a setting with more specific scope. + * + * @return the scope value. + */ + String scope(); + + /** + * Gets the inner com.azure.resourcemanager.security.fluent.models.WorkspaceSettingInner object. + * + * @return the inner object. + */ + WorkspaceSettingInner innerModel(); + + /** The entirety of the WorkspaceSetting definition. */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithCreate { + } + /** The WorkspaceSetting definition stages. */ + interface DefinitionStages { + /** The first stage of the WorkspaceSetting definition. */ + interface Blank extends WithCreate { + } + /** + * The stage of the WorkspaceSetting definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithWorkspaceId, DefinitionStages.WithScope { + /** + * Executes the create request. + * + * @return the created resource. + */ + WorkspaceSetting create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + WorkspaceSetting create(Context context); + } + /** The stage of the WorkspaceSetting definition allowing to specify workspaceId. */ + interface WithWorkspaceId { + /** + * Specifies the workspaceId property: The full Azure ID of the workspace to save the data in. + * + * @param workspaceId The full Azure ID of the workspace to save the data in. + * @return the next definition stage. + */ + WithCreate withWorkspaceId(String workspaceId); + } + /** The stage of the WorkspaceSetting definition allowing to specify scope. */ + interface WithScope { + /** + * Specifies the scope property: All the VMs in this scope will send their security data to the mentioned + * workspace unless overridden by a setting with more specific scope. + * + * @param scope All the VMs in this scope will send their security data to the mentioned workspace unless + * overridden by a setting with more specific scope. + * @return the next definition stage. + */ + WithCreate withScope(String scope); + } + } + /** + * Begins update for the WorkspaceSetting resource. + * + * @return the stage of resource update. + */ + WorkspaceSetting.Update update(); + + /** The template for WorkspaceSetting update. */ + interface Update extends UpdateStages.WithWorkspaceId, UpdateStages.WithScope { + /** + * Executes the update request. + * + * @return the updated resource. + */ + WorkspaceSetting apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + WorkspaceSetting apply(Context context); + } + /** The WorkspaceSetting update stages. */ + interface UpdateStages { + /** The stage of the WorkspaceSetting update allowing to specify workspaceId. */ + interface WithWorkspaceId { + /** + * Specifies the workspaceId property: The full Azure ID of the workspace to save the data in. + * + * @param workspaceId The full Azure ID of the workspace to save the data in. + * @return the next definition stage. + */ + Update withWorkspaceId(String workspaceId); + } + /** The stage of the WorkspaceSetting update allowing to specify scope. */ + interface WithScope { + /** + * Specifies the scope property: All the VMs in this scope will send their security data to the mentioned + * workspace unless overridden by a setting with more specific scope. + * + * @param scope All the VMs in this scope will send their security data to the mentioned workspace unless + * overridden by a setting with more specific scope. + * @return the next definition stage. + */ + Update withScope(String scope); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + WorkspaceSetting refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + WorkspaceSetting refresh(Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/WorkspaceSettingList.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/WorkspaceSettingList.java new file mode 100644 index 000000000000..fd2f66e7d383 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/WorkspaceSettingList.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.models.WorkspaceSettingInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of workspace settings response. */ +@Fluent +public final class WorkspaceSettingList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(WorkspaceSettingList.class); + + /* + * List of workspace settings + */ + @JsonProperty(value = "value", required = true) + private List value; + + /* + * The URI to fetch the next page. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: List of workspace settings. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: List of workspace settings. + * + * @param value the value value to set. + * @return the WorkspaceSettingList object itself. + */ + public WorkspaceSettingList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The URI to fetch the next page. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property value in model WorkspaceSettingList")); + } else { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/WorkspaceSettings.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/WorkspaceSettings.java new file mode 100644 index 000000000000..09610336eaee --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/WorkspaceSettings.java @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of WorkspaceSettings. */ +public interface WorkspaceSettings { + /** + * Settings about where we should store your security data and logs. If the result is empty, it means that no + * custom-workspace configuration was set. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of workspace settings response. + */ + PagedIterable list(); + + /** + * Settings about where we should store your security data and logs. If the result is empty, it means that no + * custom-workspace configuration was set. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of workspace settings response. + */ + PagedIterable list(Context context); + + /** + * Settings about where we should store your security data and logs. If the result is empty, it means that no + * custom-workspace configuration was set. + * + * @param workspaceSettingName Name of the security setting. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return configures where to store the OMS agent data for workspaces under a scope. + */ + WorkspaceSetting get(String workspaceSettingName); + + /** + * Settings about where we should store your security data and logs. If the result is empty, it means that no + * custom-workspace configuration was set. + * + * @param workspaceSettingName Name of the security setting. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return configures where to store the OMS agent data for workspaces under a scope. + */ + Response getWithResponse(String workspaceSettingName, Context context); + + /** + * Deletes the custom workspace settings for this subscription. new VMs will report to the default workspace. + * + * @param workspaceSettingName Name of the security setting. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String workspaceSettingName); + + /** + * Deletes the custom workspace settings for this subscription. new VMs will report to the default workspace. + * + * @param workspaceSettingName Name of the security setting. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response deleteWithResponse(String workspaceSettingName, Context context); + + /** + * Settings about where we should store your security data and logs. If the result is empty, it means that no + * custom-workspace configuration was set. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return configures where to store the OMS agent data for workspaces under a scope. + */ + WorkspaceSetting getById(String id); + + /** + * Settings about where we should store your security data and logs. If the result is empty, it means that no + * custom-workspace configuration was set. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return configures where to store the OMS agent data for workspaces under a scope. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes the custom workspace settings for this subscription. new VMs will report to the default workspace. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes the custom workspace settings for this subscription. new VMs will report to the default workspace. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new WorkspaceSetting resource. + * + * @param name resource name. + * @return the first stage of the new WorkspaceSetting definition. + */ + WorkspaceSetting.DefinitionStages.Blank define(String name); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/package-info.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/package-info.java new file mode 100644 index 000000000000..943e22f5f4e2 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the data models for SecurityCenter. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ +package com.azure.resourcemanager.security.models; diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/package-info.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/package-info.java new file mode 100644 index 000000000000..2460d9cab797 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the classes for SecurityCenter. API spec for Microsoft.Security (Azure Security Center) resource + * provider. + */ +package com.azure.resourcemanager.security; diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/module-info.java b/sdk/security/azure-resourcemanager-security/src/main/java/module-info.java new file mode 100644 index 000000000000..e8cd2102d160 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/module-info.java @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +module com.azure.resourcemanager.security { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.security; + exports com.azure.resourcemanager.security.fluent; + exports com.azure.resourcemanager.security.fluent.models; + exports com.azure.resourcemanager.security.models; + + opens com.azure.resourcemanager.security.fluent.models to + com.azure.core, + com.fasterxml.jackson.databind; + opens com.azure.resourcemanager.security.models to + com.azure.core, + com.fasterxml.jackson.databind; +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AdaptiveApplicationControlsDeleteSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AdaptiveApplicationControlsDeleteSamples.java new file mode 100644 index 000000000000..6435ef904f05 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AdaptiveApplicationControlsDeleteSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for AdaptiveApplicationControls Delete. */ +public final class AdaptiveApplicationControlsDeleteSamples { + /** + * Sample code: Delete an application control machine group. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void deleteAnApplicationControlMachineGroup( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager.adaptiveApplicationControls().deleteWithResponse("centralus", "GROUP1", Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AdaptiveApplicationControlsGetSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AdaptiveApplicationControlsGetSamples.java new file mode 100644 index 000000000000..e62f4c352572 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AdaptiveApplicationControlsGetSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for AdaptiveApplicationControls Get. */ +public final class AdaptiveApplicationControlsGetSamples { + /** + * Sample code: Gets a configured application control VM/server group. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void getsAConfiguredApplicationControlVMServerGroup( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager.adaptiveApplicationControls().getWithResponse("centralus", "ERELGROUP1", Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AdaptiveApplicationControlsListSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AdaptiveApplicationControlsListSamples.java new file mode 100644 index 000000000000..e1d992dcbe28 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AdaptiveApplicationControlsListSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for AdaptiveApplicationControls List. */ +public final class AdaptiveApplicationControlsListSamples { + /** + * Sample code: Gets a list of application control groups of machines for the subscription. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void getsAListOfApplicationControlGroupsOfMachinesForTheSubscription( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager.adaptiveApplicationControls().listWithResponse(true, false, Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AdaptiveApplicationControlsPutSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AdaptiveApplicationControlsPutSamples.java new file mode 100644 index 000000000000..472b6f6fa989 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AdaptiveApplicationControlsPutSamples.java @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.models.AdaptiveApplicationControlGroup; +import com.azure.resourcemanager.security.models.ConfigurationStatus; +import com.azure.resourcemanager.security.models.EnforcementMode; +import com.azure.resourcemanager.security.models.EnforcementSupport; +import com.azure.resourcemanager.security.models.FileType; +import com.azure.resourcemanager.security.models.PathRecommendation; +import com.azure.resourcemanager.security.models.ProtectionMode; +import com.azure.resourcemanager.security.models.PublisherInfo; +import com.azure.resourcemanager.security.models.RecommendationAction; +import com.azure.resourcemanager.security.models.RecommendationType; +import com.azure.resourcemanager.security.models.UserRecommendation; +import com.azure.resourcemanager.security.models.VmRecommendation; +import java.util.Arrays; + +/** Samples for AdaptiveApplicationControls Put. */ +public final class AdaptiveApplicationControlsPutSamples { + /** + * Sample code: Update an application control machine group by adding a new application. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void updateAnApplicationControlMachineGroupByAddingANewApplication( + com.azure.resourcemanager.security.SecurityManager securityManager) { + AdaptiveApplicationControlGroup resource = + securityManager + .adaptiveApplicationControls() + .getWithResponse("centralus", "ERELGROUP1", Context.NONE) + .getValue(); + resource + .update() + .withEnforcementMode(EnforcementMode.AUDIT) + .withProtectionMode( + new ProtectionMode() + .withExe(EnforcementMode.AUDIT) + .withMsi(EnforcementMode.NONE) + .withScript(EnforcementMode.NONE)) + .withVmRecommendations( + Arrays + .asList( + new VmRecommendation() + .withConfigurationStatus(ConfigurationStatus.CONFIGURED) + .withRecommendationAction(RecommendationAction.RECOMMENDED) + .withResourceId( + "/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourcegroups/erelh-stable/providers/microsoft.compute/virtualmachines/erelh-16090") + .withEnforcementSupport(EnforcementSupport.SUPPORTED), + new VmRecommendation() + .withConfigurationStatus(ConfigurationStatus.CONFIGURED) + .withRecommendationAction(RecommendationAction.RECOMMENDED) + .withResourceId( + "/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourcegroups/matanvs/providers/microsoft.compute/virtualmachines/matanvs19") + .withEnforcementSupport(EnforcementSupport.SUPPORTED))) + .withPathRecommendations( + Arrays + .asList( + new PathRecommendation() + .withPath("[Exe] O=MICROSOFT CORPORATION, L=REDMOND, S=WASHINGTON, C=US\\*\\*\\0.0.0.0") + .withAction(RecommendationAction.RECOMMENDED) + .withType(RecommendationType.fromString("PublisherSignature")) + .withPublisherInfo( + new PublisherInfo() + .withPublisherName("O=MICROSOFT CORPORATION, L=REDMOND, S=WASHINGTON, C=US") + .withProductName("*") + .withBinaryName("*") + .withVersion("0.0.0.0")) + .withCommon(true) + .withUserSids(Arrays.asList("S-1-1-0")) + .withUsernames( + Arrays + .asList( + new UserRecommendation() + .withUsername("Everyone") + .withRecommendationAction(RecommendationAction.RECOMMENDED))) + .withFileType(FileType.EXE) + .withConfigurationStatus(ConfigurationStatus.CONFIGURED), + new PathRecommendation() + .withPath("%OSDRIVE%\\WINDOWSAZURE\\SECAGENT\\WASECAGENTPROV.EXE") + .withAction(RecommendationAction.RECOMMENDED) + .withType(RecommendationType.fromString("ProductSignature")) + .withPublisherInfo( + new PublisherInfo() + .withPublisherName("CN=MICROSOFT AZURE DEPENDENCY CODE SIGN") + .withProductName("MICROSOFT® COREXT") + .withBinaryName("*") + .withVersion("0.0.0.0")) + .withCommon(true) + .withUserSids(Arrays.asList("S-1-1-0")) + .withUsernames( + Arrays + .asList( + new UserRecommendation() + .withUsername("NT AUTHORITY\\SYSTEM") + .withRecommendationAction(RecommendationAction.RECOMMENDED))) + .withFileType(FileType.EXE) + .withConfigurationStatus(ConfigurationStatus.CONFIGURED), + new PathRecommendation() + .withPath("%OSDRIVE%\\WINDOWSAZURE\\PACKAGES_201973_7415\\COLLECTGUESTLOGS.EXE") + .withAction(RecommendationAction.RECOMMENDED) + .withType(RecommendationType.fromString("PublisherSignature")) + .withPublisherInfo( + new PublisherInfo() + .withPublisherName("CN=MICROSOFT AZURE DEPENDENCY CODE SIGN") + .withProductName("*") + .withBinaryName("*") + .withVersion("0.0.0.0")) + .withCommon(true) + .withUserSids(Arrays.asList("S-1-1-0")) + .withUsernames( + Arrays + .asList( + new UserRecommendation() + .withUsername("NT AUTHORITY\\SYSTEM") + .withRecommendationAction(RecommendationAction.RECOMMENDED))) + .withFileType(FileType.EXE) + .withConfigurationStatus(ConfigurationStatus.CONFIGURED), + new PathRecommendation() + .withPath("C:\\directory\\file.exe") + .withAction(RecommendationAction.ADD) + .withType(RecommendationType.fromString("File")) + .withCommon(true))) + .apply(); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AdaptiveNetworkHardeningsEnforceSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AdaptiveNetworkHardeningsEnforceSamples.java new file mode 100644 index 000000000000..9011173cba00 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AdaptiveNetworkHardeningsEnforceSamples.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.models.AdaptiveNetworkHardeningEnforceRequest; +import com.azure.resourcemanager.security.models.Direction; +import com.azure.resourcemanager.security.models.Rule; +import com.azure.resourcemanager.security.models.TransportProtocol; +import java.util.Arrays; + +/** Samples for AdaptiveNetworkHardenings Enforce. */ +public final class AdaptiveNetworkHardeningsEnforceSamples { + /** + * Sample code: Enforces the given rules on the NSG(s) listed in the request. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void enforcesTheGivenRulesOnTheNSGSListedInTheRequest( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager + .adaptiveNetworkHardenings() + .enforce( + "rg1", + "Microsoft.Compute", + "virtualMachines", + "vm1", + "default", + new AdaptiveNetworkHardeningEnforceRequest() + .withRules( + Arrays + .asList( + new Rule() + .withName("rule1") + .withDirection(Direction.INBOUND) + .withDestinationPort(3389) + .withProtocols(Arrays.asList(TransportProtocol.TCP)) + .withIpAddresses(Arrays.asList("100.10.1.1", "200.20.2.2", "81.199.3.0/24")), + new Rule() + .withName("rule2") + .withDirection(Direction.INBOUND) + .withDestinationPort(22) + .withProtocols(Arrays.asList(TransportProtocol.TCP)) + .withIpAddresses(Arrays.asList()))) + .withNetworkSecurityGroups( + Arrays + .asList( + "/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityGroups/nsg1", + "/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/rg2/providers/Microsoft.Network/networkSecurityGroups/nsg2")), + Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AdaptiveNetworkHardeningsGetSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AdaptiveNetworkHardeningsGetSamples.java new file mode 100644 index 000000000000..0d1e20e81570 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AdaptiveNetworkHardeningsGetSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for AdaptiveNetworkHardenings Get. */ +public final class AdaptiveNetworkHardeningsGetSamples { + /** + * Sample code: Get a single Adaptive Network Hardening resource. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void getASingleAdaptiveNetworkHardeningResource( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager + .adaptiveNetworkHardenings() + .getWithResponse("rg1", "Microsoft.Compute", "virtualMachines", "vm1", "default", Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AdaptiveNetworkHardeningsListByExtendedResourceSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AdaptiveNetworkHardeningsListByExtendedResourceSamples.java new file mode 100644 index 000000000000..6743e63ee6ba --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AdaptiveNetworkHardeningsListByExtendedResourceSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for AdaptiveNetworkHardenings ListByExtendedResource. */ +public final class AdaptiveNetworkHardeningsListByExtendedResourceSamples { + /** + * Sample code: List Adaptive Network Hardenings resources of an extended resource. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void listAdaptiveNetworkHardeningsResourcesOfAnExtendedResource( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager + .adaptiveNetworkHardenings() + .listByExtendedResource("rg1", "Microsoft.Compute", "virtualMachines", "vm1", Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AdvancedThreatProtectionCreateSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AdvancedThreatProtectionCreateSamples.java new file mode 100644 index 000000000000..0bc3582019c4 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AdvancedThreatProtectionCreateSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +/** Samples for AdvancedThreatProtection Create. */ +public final class AdvancedThreatProtectionCreateSamples { + /** + * Sample code: Creates or updates the Advanced Threat Protection settings on a specified resource. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void createsOrUpdatesTheAdvancedThreatProtectionSettingsOnASpecifiedResource( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager + .advancedThreatProtections() + .define() + .withExistingResourceId( + "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/SampleRG/providers/Microsoft.Storage/storageAccounts/samplestorageaccount") + .withIsEnabled(true) + .create(); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AdvancedThreatProtectionGetSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AdvancedThreatProtectionGetSamples.java new file mode 100644 index 000000000000..d5ebfab412dc --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AdvancedThreatProtectionGetSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for AdvancedThreatProtection Get. */ +public final class AdvancedThreatProtectionGetSamples { + /** + * Sample code: Gets the Advanced Threat Protection settings for the specified resource. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void getsTheAdvancedThreatProtectionSettingsForTheSpecifiedResource( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager + .advancedThreatProtections() + .getWithResponse( + "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/SampleRG/providers/Microsoft.Storage/storageAccounts/samplestorageaccount", + Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AlertsGetResourceGroupLevelSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AlertsGetResourceGroupLevelSamples.java new file mode 100644 index 000000000000..a4d871536624 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AlertsGetResourceGroupLevelSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for Alerts GetResourceGroupLevel. */ +public final class AlertsGetResourceGroupLevelSamples { + /** + * Sample code: Get security alert on a resource group from a security data location. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void getSecurityAlertOnAResourceGroupFromASecurityDataLocation( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager + .alerts() + .getResourceGroupLevelWithResponse( + "westeurope", "2518298467986649999_4d25bfef-2d77-4a08-adc0-3e35715cc92a", "myRg1", Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AlertsGetSubscriptionLevelSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AlertsGetSubscriptionLevelSamples.java new file mode 100644 index 000000000000..e6dca7c21ae2 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AlertsGetSubscriptionLevelSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for Alerts GetSubscriptionLevel. */ +public final class AlertsGetSubscriptionLevelSamples { + /** + * Sample code: Get security alert on a subscription from a security data location. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void getSecurityAlertOnASubscriptionFromASecurityDataLocation( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager + .alerts() + .getSubscriptionLevelWithResponse( + "westeurope", "2518770965529163669_F144EE95-A3E5-42DA-A279-967D115809AA", Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AlertsListByResourceGroupSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AlertsListByResourceGroupSamples.java new file mode 100644 index 000000000000..f17ef8759418 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AlertsListByResourceGroupSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for Alerts ListByResourceGroup. */ +public final class AlertsListByResourceGroupSamples { + /** + * Sample code: Get security alerts on a resource group. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void getSecurityAlertsOnAResourceGroup( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager.alerts().listByResourceGroup("myRg1", Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AlertsListResourceGroupLevelByRegionSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AlertsListResourceGroupLevelByRegionSamples.java new file mode 100644 index 000000000000..4299958e9ee5 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AlertsListResourceGroupLevelByRegionSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for Alerts ListResourceGroupLevelByRegion. */ +public final class AlertsListResourceGroupLevelByRegionSamples { + /** + * Sample code: Get security alerts on a resource group from a security data location. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void getSecurityAlertsOnAResourceGroupFromASecurityDataLocation( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager.alerts().listResourceGroupLevelByRegion("westeurope", "myRg1", Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AlertsListSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AlertsListSamples.java new file mode 100644 index 000000000000..f2bfab347cfc --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AlertsListSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for Alerts List. */ +public final class AlertsListSamples { + /** + * Sample code: Get security alerts on a subscription. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void getSecurityAlertsOnASubscription( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager.alerts().list(Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AlertsListSubscriptionLevelByRegionSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AlertsListSubscriptionLevelByRegionSamples.java new file mode 100644 index 000000000000..da603a3f3829 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AlertsListSubscriptionLevelByRegionSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for Alerts ListSubscriptionLevelByRegion. */ +public final class AlertsListSubscriptionLevelByRegionSamples { + /** + * Sample code: Get security alerts on a subscription from a security data location. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void getSecurityAlertsOnASubscriptionFromASecurityDataLocation( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager.alerts().listSubscriptionLevelByRegion("westeurope", Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AlertsSimulateSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AlertsSimulateSamples.java new file mode 100644 index 000000000000..e8871599cf37 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AlertsSimulateSamples.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.models.AlertSimulatorBundlesRequestProperties; +import com.azure.resourcemanager.security.models.AlertSimulatorRequestBody; +import com.azure.resourcemanager.security.models.BundleType; +import java.util.Arrays; + +/** Samples for Alerts Simulate. */ +public final class AlertsSimulateSamples { + /** + * Sample code: Simulate security alerts on a subscription. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void simulateSecurityAlertsOnASubscription( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager + .alerts() + .simulate( + "centralus", + new AlertSimulatorRequestBody() + .withProperties( + new AlertSimulatorBundlesRequestProperties() + .withBundles( + Arrays + .asList( + BundleType.APP_SERVICES, + BundleType.DNS, + BundleType.KEY_VAULTS, + BundleType.KUBERNETES_SERVICE, + BundleType.RESOURCE_MANAGER, + BundleType.SQL_SERVERS, + BundleType.STORAGE_ACCOUNTS, + BundleType.VIRTUAL_MACHINES))), + Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AlertsSuppressionRulesDeleteSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AlertsSuppressionRulesDeleteSamples.java new file mode 100644 index 000000000000..b04c72b50712 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AlertsSuppressionRulesDeleteSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for AlertsSuppressionRules Delete. */ +public final class AlertsSuppressionRulesDeleteSamples { + /** + * Sample code: Delete suppression rule data for a subscription. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void deleteSuppressionRuleDataForASubscription( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager.alertsSuppressionRules().deleteWithResponse("dismissIpAnomalyAlerts", Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AlertsSuppressionRulesGetSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AlertsSuppressionRulesGetSamples.java new file mode 100644 index 000000000000..bce501954a7a --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AlertsSuppressionRulesGetSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for AlertsSuppressionRules Get. */ +public final class AlertsSuppressionRulesGetSamples { + /** + * Sample code: Get suppression alert rule for subscription. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void getSuppressionAlertRuleForSubscription( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager.alertsSuppressionRules().getWithResponse("dismissIpAnomalyAlerts", Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AlertsSuppressionRulesListSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AlertsSuppressionRulesListSamples.java new file mode 100644 index 000000000000..d105b5ebea0b --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AlertsSuppressionRulesListSamples.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for AlertsSuppressionRules List. */ +public final class AlertsSuppressionRulesListSamples { + /** + * Sample code: Get suppression rules for subscription. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void getSuppressionRulesForSubscription( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager.alertsSuppressionRules().list(null, Context.NONE); + } + + /** + * Sample code: Get suppression alert rule for subscription, filtered by AlertType. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void getSuppressionAlertRuleForSubscriptionFilteredByAlertType( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager.alertsSuppressionRules().list("IpAnomaly", Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AlertsSuppressionRulesUpdateSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AlertsSuppressionRulesUpdateSamples.java new file mode 100644 index 000000000000..d28b4c4013a6 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AlertsSuppressionRulesUpdateSamples.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.AlertsSuppressionRuleInner; +import com.azure.resourcemanager.security.models.RuleState; +import com.azure.resourcemanager.security.models.ScopeElement; +import com.azure.resourcemanager.security.models.SuppressionAlertsScope; +import java.time.OffsetDateTime; +import java.util.Arrays; + +/** Samples for AlertsSuppressionRules Update. */ +public final class AlertsSuppressionRulesUpdateSamples { + /** + * Sample code: Update or create suppression rule for subscription. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void updateOrCreateSuppressionRuleForSubscription( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager + .alertsSuppressionRules() + .updateWithResponse( + "dismissIpAnomalyAlerts", + new AlertsSuppressionRuleInner() + .withAlertType("IpAnomaly") + .withExpirationDateUtc(OffsetDateTime.parse("2019-12-01T19:50:47.083633Z")) + .withReason("FalsePositive") + .withState(RuleState.ENABLED) + .withComment("Test VM") + .withSuppressionAlertsScope( + new SuppressionAlertsScope() + .withAllOf( + Arrays + .asList( + new ScopeElement().withField("entities.ip.address"), + new ScopeElement().withField("entities.process.commandline")))), + Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AlertsUpdateResourceGroupLevelStateToActivateSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AlertsUpdateResourceGroupLevelStateToActivateSamples.java new file mode 100644 index 000000000000..c93454266a09 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AlertsUpdateResourceGroupLevelStateToActivateSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for Alerts UpdateResourceGroupLevelStateToActivate. */ +public final class AlertsUpdateResourceGroupLevelStateToActivateSamples { + /** + * Sample code: Update security alert state on a resource group from a security data location. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void updateSecurityAlertStateOnAResourceGroupFromASecurityDataLocation( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager + .alerts() + .updateResourceGroupLevelStateToActivateWithResponse( + "westeurope", "2518765996949954086_2325cf9e-42a2-4f72-ae7f-9b863cba2d22", "myRg2", Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AlertsUpdateResourceGroupLevelStateToDismissSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AlertsUpdateResourceGroupLevelStateToDismissSamples.java new file mode 100644 index 000000000000..9480ea6334c6 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AlertsUpdateResourceGroupLevelStateToDismissSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for Alerts UpdateResourceGroupLevelStateToDismiss. */ +public final class AlertsUpdateResourceGroupLevelStateToDismissSamples { + /** + * Sample code: Update security alert state on a resource group from a security data location. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void updateSecurityAlertStateOnAResourceGroupFromASecurityDataLocation( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager + .alerts() + .updateResourceGroupLevelStateToDismissWithResponse( + "westeurope", "2518765996949954086_2325cf9e-42a2-4f72-ae7f-9b863cba2d22", "myRg2", Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AlertsUpdateResourceGroupLevelStateToResolveSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AlertsUpdateResourceGroupLevelStateToResolveSamples.java new file mode 100644 index 000000000000..979eacb0e4ea --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AlertsUpdateResourceGroupLevelStateToResolveSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for Alerts UpdateResourceGroupLevelStateToResolve. */ +public final class AlertsUpdateResourceGroupLevelStateToResolveSamples { + /** + * Sample code: Update security alert state on a resource group from a security data location. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void updateSecurityAlertStateOnAResourceGroupFromASecurityDataLocation( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager + .alerts() + .updateResourceGroupLevelStateToResolveWithResponse( + "westeurope", "2518765996949954086_2325cf9e-42a2-4f72-ae7f-9b863cba2d22", "myRg2", Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AlertsUpdateSubscriptionLevelStateToActivateSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AlertsUpdateSubscriptionLevelStateToActivateSamples.java new file mode 100644 index 000000000000..1c79383ea6de --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AlertsUpdateSubscriptionLevelStateToActivateSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for Alerts UpdateSubscriptionLevelStateToActivate. */ +public final class AlertsUpdateSubscriptionLevelStateToActivateSamples { + /** + * Sample code: Update security alert state on a subscription from a security data location. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void updateSecurityAlertStateOnASubscriptionFromASecurityDataLocation( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager + .alerts() + .updateSubscriptionLevelStateToActivateWithResponse( + "westeurope", "2518298467986649999_4d25bfef-2d77-4a08-adc0-3e35715cc92a", Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AlertsUpdateSubscriptionLevelStateToDismissSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AlertsUpdateSubscriptionLevelStateToDismissSamples.java new file mode 100644 index 000000000000..063a15d27614 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AlertsUpdateSubscriptionLevelStateToDismissSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for Alerts UpdateSubscriptionLevelStateToDismiss. */ +public final class AlertsUpdateSubscriptionLevelStateToDismissSamples { + /** + * Sample code: Update security alert state on a subscription from a security data location. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void updateSecurityAlertStateOnASubscriptionFromASecurityDataLocation( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager + .alerts() + .updateSubscriptionLevelStateToDismissWithResponse( + "westeurope", "2518298467986649999_4d25bfef-2d77-4a08-adc0-3e35715cc92a", Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AlertsUpdateSubscriptionLevelStateToResolveSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AlertsUpdateSubscriptionLevelStateToResolveSamples.java new file mode 100644 index 000000000000..301b29f467de --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AlertsUpdateSubscriptionLevelStateToResolveSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for Alerts UpdateSubscriptionLevelStateToResolve. */ +public final class AlertsUpdateSubscriptionLevelStateToResolveSamples { + /** + * Sample code: Update security alert state on a subscription from a security data location. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void updateSecurityAlertStateOnASubscriptionFromASecurityDataLocation( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager + .alerts() + .updateSubscriptionLevelStateToResolveWithResponse( + "westeurope", "2518298467986649999_4d25bfef-2d77-4a08-adc0-3e35715cc92a", Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AllowedConnectionsGetSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AllowedConnectionsGetSamples.java new file mode 100644 index 000000000000..8e5ceeae6b07 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AllowedConnectionsGetSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.models.ConnectionType; + +/** Samples for AllowedConnections Get. */ +public final class AllowedConnectionsGetSamples { + /** + * Sample code: Get allowed connections. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void getAllowedConnections(com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager + .allowedConnections() + .getWithResponse("myResourceGroup", "centralus", ConnectionType.INTERNAL, Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AllowedConnectionsListByHomeRegionSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AllowedConnectionsListByHomeRegionSamples.java new file mode 100644 index 000000000000..f8fdee135aef --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AllowedConnectionsListByHomeRegionSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for AllowedConnections ListByHomeRegion. */ +public final class AllowedConnectionsListByHomeRegionSamples { + /** + * Sample code: Get allowed connections on a subscription from security data location. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void getAllowedConnectionsOnASubscriptionFromSecurityDataLocation( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager.allowedConnections().listByHomeRegion("centralus", Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AllowedConnectionsListSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AllowedConnectionsListSamples.java new file mode 100644 index 000000000000..d3301223298a --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AllowedConnectionsListSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for AllowedConnections List. */ +public final class AllowedConnectionsListSamples { + /** + * Sample code: Get allowed connections on a subscription. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void getAllowedConnectionsOnASubscription( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager.allowedConnections().list(Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AssessmentsCreateOrUpdateSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AssessmentsCreateOrUpdateSamples.java new file mode 100644 index 000000000000..71325ee1b975 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AssessmentsCreateOrUpdateSamples.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.resourcemanager.security.models.AssessmentStatus; +import com.azure.resourcemanager.security.models.AssessmentStatusCode; +import com.azure.resourcemanager.security.models.AzureResourceDetails; + +/** Samples for Assessments CreateOrUpdate. */ +public final class AssessmentsCreateOrUpdateSamples { + /** + * Sample code: Create security recommendation task on a resource. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void createSecurityRecommendationTaskOnAResource( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager + .assessments() + .define("8bb8be0a-6010-4789-812f-e4d661c4ed0e") + .withExistingResourceId( + "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.Compute/virtualMachineScaleSets/vmss2") + .withResourceDetails(new AzureResourceDetails()) + .withStatus(new AssessmentStatus().withCode(AssessmentStatusCode.HEALTHY)) + .create(); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AssessmentsDeleteSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AssessmentsDeleteSamples.java new file mode 100644 index 000000000000..c95270597fe8 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AssessmentsDeleteSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for Assessments Delete. */ +public final class AssessmentsDeleteSamples { + /** + * Sample code: Delete a security recommendation task on a resource. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void deleteASecurityRecommendationTaskOnAResource( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager + .assessments() + .deleteWithResponse( + "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.Compute/virtualMachineScaleSets/vmss2", + "8bb8be0a-6010-4789-812f-e4d661c4ed0e", + Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AssessmentsGetSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AssessmentsGetSamples.java new file mode 100644 index 000000000000..c64fb805494d --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AssessmentsGetSamples.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.models.ExpandEnum; + +/** Samples for Assessments Get. */ +public final class AssessmentsGetSamples { + /** + * Sample code: Get security recommendation task from security data location with expand parameter. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void getSecurityRecommendationTaskFromSecurityDataLocationWithExpandParameter( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager + .assessments() + .getWithResponse( + "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.Compute/virtualMachineScaleSets/vmss2", + "21300918-b2e3-0346-785f-c77ff57d243b", + ExpandEnum.LINKS, + Context.NONE); + } + + /** + * Sample code: Get security recommendation task from security data location. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void getSecurityRecommendationTaskFromSecurityDataLocation( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager + .assessments() + .getWithResponse( + "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.Compute/virtualMachineScaleSets/vmss2", + "21300918-b2e3-0346-785f-c77ff57d243b", + null, + Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AssessmentsListSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AssessmentsListSamples.java new file mode 100644 index 000000000000..f0b9d5c95373 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AssessmentsListSamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for Assessments List. */ +public final class AssessmentsListSamples { + /** + * Sample code: List security assessments. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void listSecurityAssessments(com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager.assessments().list("subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23", Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AssessmentsMetadataCreateInSubscriptionSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AssessmentsMetadataCreateInSubscriptionSamples.java new file mode 100644 index 000000000000..8c2e3722177d --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AssessmentsMetadataCreateInSubscriptionSamples.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.resourcemanager.security.models.AssessmentType; +import com.azure.resourcemanager.security.models.Categories; +import com.azure.resourcemanager.security.models.ImplementationEffort; +import com.azure.resourcemanager.security.models.Severity; +import com.azure.resourcemanager.security.models.Threats; +import com.azure.resourcemanager.security.models.UserImpact; +import java.util.Arrays; + +/** Samples for AssessmentsMetadata CreateInSubscription. */ +public final class AssessmentsMetadataCreateInSubscriptionSamples { + /** + * Sample code: Create security assessment metadata for subscription. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void createSecurityAssessmentMetadataForSubscription( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager + .assessmentsMetadatas() + .define("ca039e75-a276-4175-aebc-bcd41e4b14b7") + .withDisplayName("Install endpoint protection solution on virtual machine scale sets") + .withDescription( + "Install an endpoint protection solution on your virtual machines scale sets, to protect them from" + + " threats and vulnerabilities.") + .withRemediationDescription( + "To install an endpoint protection solution: 1. Follow" + + " the instructions in How do I turn on antimalware in my virtual machine scale set") + .withCategories(Arrays.asList(Categories.COMPUTE)) + .withSeverity(Severity.MEDIUM) + .withUserImpact(UserImpact.LOW) + .withImplementationEffort(ImplementationEffort.LOW) + .withThreats(Arrays.asList(Threats.DATA_EXFILTRATION, Threats.DATA_SPILLAGE, Threats.MALICIOUS_INSIDER)) + .withAssessmentType(AssessmentType.CUSTOMER_MANAGED) + .create(); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AssessmentsMetadataDeleteInSubscriptionSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AssessmentsMetadataDeleteInSubscriptionSamples.java new file mode 100644 index 000000000000..f67e791be433 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AssessmentsMetadataDeleteInSubscriptionSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for AssessmentsMetadata DeleteInSubscription. */ +public final class AssessmentsMetadataDeleteInSubscriptionSamples { + /** + * Sample code: Delete a security assessment metadata for subscription. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void deleteASecurityAssessmentMetadataForSubscription( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager + .assessmentsMetadatas() + .deleteInSubscriptionWithResponse("ca039e75-a276-4175-aebc-bcd41e4b14b7", Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AssessmentsMetadataGetInSubscriptionSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AssessmentsMetadataGetInSubscriptionSamples.java new file mode 100644 index 000000000000..513b3070de02 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AssessmentsMetadataGetInSubscriptionSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for AssessmentsMetadata GetInSubscription. */ +public final class AssessmentsMetadataGetInSubscriptionSamples { + /** + * Sample code: Get security assessment metadata for subscription. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void getSecurityAssessmentMetadataForSubscription( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager + .assessmentsMetadatas() + .getInSubscriptionWithResponse("21300918-b2e3-0346-785f-c77ff57d243b", Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AssessmentsMetadataGetSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AssessmentsMetadataGetSamples.java new file mode 100644 index 000000000000..88ca93e16d66 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AssessmentsMetadataGetSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for AssessmentsMetadata Get. */ +public final class AssessmentsMetadataGetSamples { + /** + * Sample code: Get security assessment metadata. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void getSecurityAssessmentMetadata( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager.assessmentsMetadatas().getWithResponse("21300918-b2e3-0346-785f-c77ff57d243b", Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AssessmentsMetadataListBySubscriptionSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AssessmentsMetadataListBySubscriptionSamples.java new file mode 100644 index 000000000000..d7d669ee7a16 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AssessmentsMetadataListBySubscriptionSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for AssessmentsMetadata ListBySubscription. */ +public final class AssessmentsMetadataListBySubscriptionSamples { + /** + * Sample code: List security assessment metadata for subscription. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void listSecurityAssessmentMetadataForSubscription( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager.assessmentsMetadatas().listBySubscription(Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AssessmentsMetadataListSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AssessmentsMetadataListSamples.java new file mode 100644 index 000000000000..d585b083bc2f --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AssessmentsMetadataListSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for AssessmentsMetadata List. */ +public final class AssessmentsMetadataListSamples { + /** + * Sample code: List security assessment metadata. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void listSecurityAssessmentMetadata( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager.assessmentsMetadatas().list(Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AutoProvisioningSettingsCreateSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AutoProvisioningSettingsCreateSamples.java new file mode 100644 index 000000000000..92ce0509faf4 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AutoProvisioningSettingsCreateSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.resourcemanager.security.models.AutoProvision; + +/** Samples for AutoProvisioningSettings Create. */ +public final class AutoProvisioningSettingsCreateSamples { + /** + * Sample code: Create auto provisioning settings for subscription. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void createAutoProvisioningSettingsForSubscription( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager.autoProvisioningSettings().define("default").withAutoProvision(AutoProvision.ON).create(); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AutoProvisioningSettingsGetSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AutoProvisioningSettingsGetSamples.java new file mode 100644 index 000000000000..ddd48fe7eeb0 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AutoProvisioningSettingsGetSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for AutoProvisioningSettings Get. */ +public final class AutoProvisioningSettingsGetSamples { + /** + * Sample code: Get an auto provisioning setting for subscription. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void getAnAutoProvisioningSettingForSubscription( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager.autoProvisioningSettings().getWithResponse("default", Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AutoProvisioningSettingsListSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AutoProvisioningSettingsListSamples.java new file mode 100644 index 000000000000..b3c1dca86f1b --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AutoProvisioningSettingsListSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for AutoProvisioningSettings List. */ +public final class AutoProvisioningSettingsListSamples { + /** + * Sample code: Get auto provisioning settings for subscription. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void getAutoProvisioningSettingsForSubscription( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager.autoProvisioningSettings().list(Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AutomationsCreateOrUpdateSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AutomationsCreateOrUpdateSamples.java new file mode 100644 index 000000000000..83c4006099e9 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AutomationsCreateOrUpdateSamples.java @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.resourcemanager.security.models.AutomationActionLogicApp; +import com.azure.resourcemanager.security.models.AutomationRuleSet; +import com.azure.resourcemanager.security.models.AutomationScope; +import com.azure.resourcemanager.security.models.AutomationSource; +import com.azure.resourcemanager.security.models.AutomationTriggeringRule; +import com.azure.resourcemanager.security.models.EventSource; +import com.azure.resourcemanager.security.models.Operator; +import com.azure.resourcemanager.security.models.PropertyType; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for Automations CreateOrUpdate. */ +public final class AutomationsCreateOrUpdateSamples { + /** + * Sample code: Create or update a security automation for all assessments (including all severities). + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void createOrUpdateASecurityAutomationForAllAssessmentsIncludingAllSeverities( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager + .automations() + .define("exampleAutomation") + .withRegion("Central US") + .withExistingResourceGroup("exampleResourceGroup") + .withTags(mapOf()) + .withDescription( + "An example of a security automation that triggers one LogicApp resource (myTest1) on any security" + + " assessment") + .withIsEnabled(true) + .withScopes( + Arrays + .asList( + new AutomationScope() + .withDescription( + "A description that helps to identify this scope - for example: security assessments" + + " that relate to the resource group myResourceGroup within the subscription" + + " a5caac9c-5c04-49af-b3d0-e204f40345d5") + .withScopePath( + "/subscriptions/a5caac9c-5c04-49af-b3d0-e204f40345d5/resourceGroups/myResourceGroup"))) + .withSources(Arrays.asList(new AutomationSource().withEventSource(EventSource.ASSESSMENTS))) + .withActions( + Arrays + .asList( + new AutomationActionLogicApp() + .withLogicAppResourceId( + "/subscriptions/e54a4a18-5b94-4f90-9471-bd3decad8a2e/resourceGroups/sample/providers/Microsoft.Logic/workflows/MyTest1") + .withUri("https://exampleTriggerUri1.com"))) + .create(); + } + + /** + * Sample code: Disable or enable a security automation. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void disableOrEnableASecurityAutomation( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager + .automations() + .define("exampleAutomation") + .withRegion("Central US") + .withExistingResourceGroup("exampleResourceGroup") + .withTags(mapOf()) + .withDescription( + "An example of a security automation that triggers one LogicApp resource (myTest1) on any security" + + " assessment of type customAssessment") + .withIsEnabled(false) + .withScopes( + Arrays + .asList( + new AutomationScope() + .withDescription( + "A description that helps to identify this scope - for example: security assessments" + + " that relate to the resource group myResourceGroup within the subscription" + + " a5caac9c-5c04-49af-b3d0-e204f40345d5") + .withScopePath( + "/subscriptions/a5caac9c-5c04-49af-b3d0-e204f40345d5/resourceGroups/myResourceGroup"))) + .withSources( + Arrays + .asList( + new AutomationSource() + .withEventSource(EventSource.ASSESSMENTS) + .withRuleSets( + Arrays + .asList( + new AutomationRuleSet() + .withRules( + Arrays + .asList( + new AutomationTriggeringRule() + .withPropertyJPath("$.Entity.AssessmentType") + .withPropertyType(PropertyType.STRING) + .withExpectedValue("customAssessment") + .withOperator(Operator.EQUALS))))))) + .withActions( + Arrays + .asList( + new AutomationActionLogicApp() + .withLogicAppResourceId( + "/subscriptions/e54a4a18-5b94-4f90-9471-bd3decad8a2e/resourceGroups/sample/providers/Microsoft.Logic/workflows/MyTest1") + .withUri("https://exampleTriggerUri1.com"))) + .create(); + } + + /** + * Sample code: Create or update a security automation for all high severity assessments. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void createOrUpdateASecurityAutomationForAllHighSeverityAssessments( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager + .automations() + .define("exampleAutomation") + .withRegion("Central US") + .withExistingResourceGroup("exampleResourceGroup") + .withTags(mapOf()) + .withDescription( + "An example of a security automation that triggers one LogicApp resource (myTest1) on any high" + + " severity security assessment") + .withIsEnabled(true) + .withScopes( + Arrays + .asList( + new AutomationScope() + .withDescription( + "A description that helps to identify this scope - for example: security assessments" + + " that relate to the resource group myResourceGroup within the subscription" + + " a5caac9c-5c04-49af-b3d0-e204f40345d5") + .withScopePath( + "/subscriptions/a5caac9c-5c04-49af-b3d0-e204f40345d5/resourceGroups/myResourceGroup"))) + .withSources( + Arrays + .asList( + new AutomationSource() + .withEventSource(EventSource.ASSESSMENTS) + .withRuleSets( + Arrays + .asList( + new AutomationRuleSet() + .withRules( + Arrays + .asList( + new AutomationTriggeringRule() + .withPropertyJPath("properties.metadata.severity") + .withPropertyType(PropertyType.STRING) + .withExpectedValue("High") + .withOperator(Operator.EQUALS))))))) + .withActions( + Arrays + .asList( + new AutomationActionLogicApp() + .withLogicAppResourceId( + "/subscriptions/e54a4a18-5b94-4f90-9471-bd3decad8a2e/resourceGroups/sample/providers/Microsoft.Logic/workflows/MyTest1") + .withUri("https://exampleTriggerUri1.com"))) + .create(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AutomationsDeleteSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AutomationsDeleteSamples.java new file mode 100644 index 000000000000..d585a60e0068 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AutomationsDeleteSamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for Automations Delete. */ +public final class AutomationsDeleteSamples { + /** + * Sample code: Delete a security automation. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void deleteASecurityAutomation(com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager.automations().deleteWithResponse("myRg", "myAutomationName", Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AutomationsGetByResourceGroupSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AutomationsGetByResourceGroupSamples.java new file mode 100644 index 000000000000..99afedcd551c --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AutomationsGetByResourceGroupSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for Automations GetByResourceGroup. */ +public final class AutomationsGetByResourceGroupSamples { + /** + * Sample code: Retrieve a security automation. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void retrieveASecurityAutomation(com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager + .automations() + .getByResourceGroupWithResponse("exampleResourceGroup", "exampleAutomation", Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AutomationsListByResourceGroupSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AutomationsListByResourceGroupSamples.java new file mode 100644 index 000000000000..6c915da44fc3 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AutomationsListByResourceGroupSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for Automations ListByResourceGroup. */ +public final class AutomationsListByResourceGroupSamples { + /** + * Sample code: List all security automations of a specified resource group. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void listAllSecurityAutomationsOfASpecifiedResourceGroup( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager.automations().listByResourceGroup("exampleResourceGroup", Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AutomationsListSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AutomationsListSamples.java new file mode 100644 index 000000000000..f6c94c83785c --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AutomationsListSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for Automations List. */ +public final class AutomationsListSamples { + /** + * Sample code: List all security automations of a specified subscription. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void listAllSecurityAutomationsOfASpecifiedSubscription( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager.automations().list(Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AutomationsValidateSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AutomationsValidateSamples.java new file mode 100644 index 000000000000..e0f22b8ea6e3 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/AutomationsValidateSamples.java @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.AutomationInner; +import com.azure.resourcemanager.security.models.AutomationActionLogicApp; +import com.azure.resourcemanager.security.models.AutomationRuleSet; +import com.azure.resourcemanager.security.models.AutomationScope; +import com.azure.resourcemanager.security.models.AutomationSource; +import com.azure.resourcemanager.security.models.AutomationTriggeringRule; +import com.azure.resourcemanager.security.models.EventSource; +import com.azure.resourcemanager.security.models.Operator; +import com.azure.resourcemanager.security.models.PropertyType; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for Automations Validate. */ +public final class AutomationsValidateSamples { + /** + * Sample code: Validate the security automation model before create or update. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void validateTheSecurityAutomationModelBeforeCreateOrUpdate( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager + .automations() + .validateWithResponse( + "exampleResourceGroup", + "exampleAutomation", + new AutomationInner() + .withLocation("Central US") + .withTags(mapOf()) + .withDescription( + "An example of a security automation that triggers one LogicApp resource (myTest1) on any" + + " security assessment of type customAssessment") + .withIsEnabled(true) + .withScopes( + Arrays + .asList( + new AutomationScope() + .withDescription( + "A description that helps to identify this scope - for example: security" + + " assessments that relate to the resource group myResourceGroup within" + + " the subscription a5caac9c-5c04-49af-b3d0-e204f40345d5") + .withScopePath( + "/subscriptions/a5caac9c-5c04-49af-b3d0-e204f40345d5/resourceGroups/myResourceGroup"))) + .withSources( + Arrays + .asList( + new AutomationSource() + .withEventSource(EventSource.ASSESSMENTS) + .withRuleSets( + Arrays + .asList( + new AutomationRuleSet() + .withRules( + Arrays + .asList( + new AutomationTriggeringRule() + .withPropertyJPath("$.Entity.AssessmentType") + .withPropertyType(PropertyType.STRING) + .withExpectedValue("customAssessment") + .withOperator(Operator.EQUALS))))))) + .withActions( + Arrays + .asList( + new AutomationActionLogicApp() + .withLogicAppResourceId( + "/subscriptions/e54a4a18-5b94-4f90-9471-bd3decad8a2e/resourceGroups/sample/providers/Microsoft.Logic/workflows/MyTest1") + .withUri("https://exampleTriggerUri1.com"))), + Context.NONE); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/ComplianceResultsGetSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/ComplianceResultsGetSamples.java new file mode 100644 index 000000000000..8e71d2c666e3 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/ComplianceResultsGetSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for ComplianceResults Get. */ +public final class ComplianceResultsGetSamples { + /** + * Sample code: Get compliance results on subscription. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void getComplianceResultsOnSubscription( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager + .complianceResults() + .getWithResponse( + "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23", "DesignateMoreThanOneOwner", Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/ComplianceResultsListSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/ComplianceResultsListSamples.java new file mode 100644 index 000000000000..8651c5df1f20 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/ComplianceResultsListSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for ComplianceResults List. */ +public final class ComplianceResultsListSamples { + /** + * Sample code: Get compliance results on subscription. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void getComplianceResultsOnSubscription( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager.complianceResults().list("subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23", Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/CompliancesGetSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/CompliancesGetSamples.java new file mode 100644 index 000000000000..01a4b15de0c4 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/CompliancesGetSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for Compliances Get. */ +public final class CompliancesGetSamples { + /** + * Sample code: Get security compliance data for a day. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void getSecurityComplianceDataForADay( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager + .compliances() + .getWithResponse("subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23", "2018-01-01Z", Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/CompliancesListSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/CompliancesListSamples.java new file mode 100644 index 000000000000..11bb2ab6ac87 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/CompliancesListSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for Compliances List. */ +public final class CompliancesListSamples { + /** + * Sample code: Get security compliance data over time. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void getSecurityComplianceDataOverTime( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager.compliances().list("subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23", Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/ConnectorsCreateOrUpdateSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/ConnectorsCreateOrUpdateSamples.java new file mode 100644 index 000000000000..6ab5decade7b --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/ConnectorsCreateOrUpdateSamples.java @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.resourcemanager.security.models.AutoProvision; +import com.azure.resourcemanager.security.models.AwAssumeRoleAuthenticationDetailsProperties; +import com.azure.resourcemanager.security.models.AwsCredsAuthenticationDetailsProperties; +import com.azure.resourcemanager.security.models.GcpCredentialsDetailsProperties; +import com.azure.resourcemanager.security.models.HybridComputeSettingsProperties; +import com.azure.resourcemanager.security.models.ProxyServerProperties; +import com.azure.resourcemanager.security.models.ServicePrincipalProperties; + +/** Samples for Connectors CreateOrUpdate. */ +public final class ConnectorsCreateOrUpdateSamples { + /** + * Sample code: gcpCredentials - Create a cloud account connector for a subscription. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void gcpCredentialsCreateACloudAccountConnectorForASubscription( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager + .connectors() + .define("gcp_dev") + .withHybridComputeSettings(new HybridComputeSettingsProperties().withAutoProvision(AutoProvision.OFF)) + .withAuthenticationDetails( + new GcpCredentialsDetailsProperties() + .withOrganizationId("AscDemoOrg") + .withType("service_account") + .withProjectId("asc-project-1234") + .withPrivateKeyId("6efg587hra2568as34d22326b044cc20dc2af") + .withPrivateKey( + "-----BEGIN PRIVATE KEY-----\n" + + "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCpxYHcLzcDZ6/Q\n" + + "AeQZnQXM5GTb3p09Xsbjo2T2F61b6I7FZiQXBrbw3Zf0CUCkkqTTpD5xifl82yQ6\n" + + "89V7SAe8hxI7esAcVDhm/aJMqzVjHLISAU2L3li1sn0jjY2oYtndwN6bRivP8O6t\n" + + "9F+W6E0zMlbCxtpZEHLbb6WxlJJrwEQ0MPH2yOCwZUQi6NHksAtEzX2nNKJNyUC7\n" + + "QyBVHHMm34H2bmZwsuQp3y2otpcJ9tJnVmYfC3k/w4x2L+DIK7JnQP/C1wQqu2du\n" + + "c0w6sydF6RhLoHButrVdYRJTdfK4k03SsSTyMqZ+f7LNnKw3xenzw1VmEpk8mvoQ\n" + + "t08tCBOrAgMBAAECggEAByzz6iyMtLYjNjV+QJ7kad6VbL2iA8AHxANZ9xTVHPdd\n" + + "YXaJu/dqsA+NpqDlfI8+LDva782XH/HbPCqmMUnAGfXTjXQIvqnIoIHD5F2wKfpC\n" + + "hIRNlMXXFgbvRxtqi11yO+80+XcjzuwuCmgzyhsTeEB+bkkdXXpWgHPdmv3emnM6\n" + + "MQM9Zgrug0UndPmiUwKOcJSU4PlmlTpHEV4vA6JfA4bvphy9m1jxO5qWeah5yym2\n" + + "6FP5BRIDF98kFrDnSXJjajwgLCQ+MypFQXyax6XkxDxuKXbng1bv7eZDjqazIChk\n" + + "m0y14X0s0jnWc+AX8vfeSf7d+EsGdVinEwR1aAawEQKBgQDqDB0qxcIQ1oI1Kww8\n" + + "9vXefTiuWsf47F+fJ/DIOEbiRfE8IdCgmOABvcqJIoxW/DFMBEdLCcx73Km7pOmd\n" + + "Kg1ddScnaO8cOj2v/Ub+fAqVrA4ki4ViYP0A7/Nogga3Jr/x3ey5bitrIfFImteS\n" + + "CgBHBzZvoQpvO4lB2tKVgo2P9wKBgQC5sgTEq4sasRGSAY6lIoJno0I8w28a/16D\n" + + "es60XQeY1ger8uTGwlT02v/u/arDUmRLPClpujXq6gK29KvtRCHy7JkpGbqW2bZs\n" + + "PFKKWR7Tk3XPKYyjv94AIi5/xoFeDhS4lpAvy3Z5tQhYS6wqWKvT6yZQ3kM+Hfxs\n" + + "pHgvu3mU7QKBgQC9/E1k3hj1cBtMK4CIsHPPQljTd4+iacYJPPPAo6YuoVX8WPqw\n" + + "ksgrwbN59Fh1d8xQh5yTtgWOegYx8uFMGcm1lpbM7+pBQKm4hWGuzGQPMRZd5f/F\n" + + "ZzOZIi61I+9tlv/yxxIVR+/ozCm/pSneO04UWi9/F/uPZYW6tnWAtfRR6wKBgGsZ\n" + + "8MQaCK4JaI/klAhMghgSQnbXZXKVzUZaA3Rln6cX8u7KtgapOOTMlwaZie8Dy1LV\n" + + "TTFstAJcm9o3/h1nyYjZy3C4JTUyNpPwqs6enjf7edxVI4eidwFutZD+xcigqHTa\n" + + "aikW2atSrZB3fMIjyF7+5meH+hKOqvNiXOty3qn1AoGAZuVxYQy5FVq3YZxzr3Aa\n" + + "Am0ShoXTF6QYIbsaUiUGoa/NlHcw9V/lj4AqBRbxbaYMD+hz2J/od9cb268eJKY8\n" + + "3b6MvaUqdNhNnWodJXLhgtmGEHDKmTppz2JSTx/tVzCfhFdcOC79StZvcKLhtoFQ\n" + + "+/3lEw6NCIXzm5E4+dtJG4k=\n" + + "-----END PRIVATE KEY-----\n") + .withClientEmail("asc-135@asc-project-1234.iam.gserviceaccount.com") + .withClientId("105889053725632919854") + .withAuthUri("https://accounts.google.com/o/oauth2/auth") + .withTokenUri("https://oauth2.googleapis.com/token") + .withAuthProviderX509CertUrl("https://www.googleapis.com/oauth2/v1/certs") + .withClientX509CertUrl( + "https://www.googleapis.com/robot/v1/metadata/x509/asc-135%40asc-project-1234.iam.gserviceaccount.com")) + .create(); + } + + /** + * Sample code: AwsCred - Create a cloud account connector for a subscription. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void awsCredCreateACloudAccountConnectorForASubscription( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager + .connectors() + .define("aws_dev1") + .withHybridComputeSettings( + new HybridComputeSettingsProperties() + .withAutoProvision(AutoProvision.ON) + .withResourceGroupName("AwsConnectorRG") + .withRegion("West US 2") + .withProxyServer(new ProxyServerProperties().withIp("167.220.197.140").withPort("34")) + .withServicePrincipal( + new ServicePrincipalProperties() + .withApplicationId("ad9bcd79-be9c-45ab-abd8-80ca1654a7d1") + .withSecret(""))) + .withAuthenticationDetails( + new AwsCredsAuthenticationDetailsProperties() + .withAwsAccessKeyId("AKIARPZCNODDNAEQFSOE") + .withAwsSecretAccessKey("")) + .create(); + } + + /** + * Sample code: AwsAssumeRole - Create a cloud account connector for a subscription. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void awsAssumeRoleCreateACloudAccountConnectorForASubscription( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager + .connectors() + .define("aws_dev2") + .withHybridComputeSettings( + new HybridComputeSettingsProperties() + .withAutoProvision(AutoProvision.ON) + .withResourceGroupName("AwsConnectorRG") + .withRegion("West US 2") + .withProxyServer(new ProxyServerProperties().withIp("167.220.197.140").withPort("34")) + .withServicePrincipal( + new ServicePrincipalProperties() + .withApplicationId("ad9bcd79-be9c-45ab-abd8-80ca1654a7d1") + .withSecret(""))) + .withAuthenticationDetails( + new AwAssumeRoleAuthenticationDetailsProperties() + .withAwsAssumeRoleArn("arn:aws:iam::81231569658:role/AscConnector") + .withAwsExternalId("20ff7fc3-e762-44dd-bd96-b71116dcdc23")) + .create(); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/ConnectorsDeleteSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/ConnectorsDeleteSamples.java new file mode 100644 index 000000000000..ec0a2aefeede --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/ConnectorsDeleteSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for Connectors Delete. */ +public final class ConnectorsDeleteSamples { + /** + * Sample code: Delete a cloud account connector from a subscription. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void deleteACloudAccountConnectorFromASubscription( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager.connectors().deleteWithResponse("aws_dev1", Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/ConnectorsGetSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/ConnectorsGetSamples.java new file mode 100644 index 000000000000..3e917841ce23 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/ConnectorsGetSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for Connectors Get. */ +public final class ConnectorsGetSamples { + /** + * Sample code: Details of a specific cloud account connector. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void detailsOfASpecificCloudAccountConnector( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager.connectors().getWithResponse("aws_dev1", Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/ConnectorsListSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/ConnectorsListSamples.java new file mode 100644 index 000000000000..5b366d2f8e5a --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/ConnectorsListSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for Connectors List. */ +public final class ConnectorsListSamples { + /** + * Sample code: Get all cloud accounts connectors of a subscription. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void getAllCloudAccountsConnectorsOfASubscription( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager.connectors().list(Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/DeviceGetSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/DeviceGetSamples.java new file mode 100644 index 000000000000..2e2dc5bde383 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/DeviceGetSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for Device Get. */ +public final class DeviceGetSamples { + /** + * Sample code: Get Device. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void getDevice(com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager + .devices() + .getWithResponse( + "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/MyGroup/providers/Microsoft.Devices/iotHubs/myHub", + "myDevice", + Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/DeviceSecurityGroupsCreateOrUpdateSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/DeviceSecurityGroupsCreateOrUpdateSamples.java new file mode 100644 index 000000000000..1a9fc303bef9 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/DeviceSecurityGroupsCreateOrUpdateSamples.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.resourcemanager.security.models.ActiveConnectionsNotInAllowedRange; +import java.time.Duration; +import java.util.Arrays; + +/** Samples for DeviceSecurityGroups CreateOrUpdate. */ +public final class DeviceSecurityGroupsCreateOrUpdateSamples { + /** + * Sample code: Create or update a device security group for the specified IoT hub resource. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void createOrUpdateADeviceSecurityGroupForTheSpecifiedIoTHubResource( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager + .deviceSecurityGroups() + .define("samplesecuritygroup") + .withExistingResourceId( + "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/SampleRG/providers/Microsoft.Devices/iotHubs/sampleiothub") + .withTimeWindowRules( + Arrays + .asList( + new ActiveConnectionsNotInAllowedRange() + .withIsEnabled(true) + .withMinThreshold(0) + .withMaxThreshold(30) + .withTimeWindowSize(Duration.parse("PT05M")))) + .create(); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/DeviceSecurityGroupsDeleteSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/DeviceSecurityGroupsDeleteSamples.java new file mode 100644 index 000000000000..1d020d236723 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/DeviceSecurityGroupsDeleteSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for DeviceSecurityGroups Delete. */ +public final class DeviceSecurityGroupsDeleteSamples { + /** + * Sample code: Delete a device security group for the specified IoT Hub resource. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void deleteADeviceSecurityGroupForTheSpecifiedIoTHubResource( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager + .deviceSecurityGroups() + .deleteWithResponse( + "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/SampleRG/providers/Microsoft.Devices/iotHubs/sampleiothub", + "samplesecuritygroup", + Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/DeviceSecurityGroupsGetSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/DeviceSecurityGroupsGetSamples.java new file mode 100644 index 000000000000..e4aa1153ce3a --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/DeviceSecurityGroupsGetSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for DeviceSecurityGroups Get. */ +public final class DeviceSecurityGroupsGetSamples { + /** + * Sample code: Get a device security group for the specified IoT Hub resource. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void getADeviceSecurityGroupForTheSpecifiedIoTHubResource( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager + .deviceSecurityGroups() + .getWithResponse( + "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/SampleRG/providers/Microsoft.Devices/iotHubs/sampleiothub", + "samplesecuritygroup", + Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/DeviceSecurityGroupsListSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/DeviceSecurityGroupsListSamples.java new file mode 100644 index 000000000000..5858a1d45d04 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/DeviceSecurityGroupsListSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for DeviceSecurityGroups List. */ +public final class DeviceSecurityGroupsListSamples { + /** + * Sample code: List all device security groups for the specified IoT Hub resource. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void listAllDeviceSecurityGroupsForTheSpecifiedIoTHubResource( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager + .deviceSecurityGroups() + .list( + "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/SampleRG/providers/Microsoft.Devices/iotHubs/sampleiothub", + Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/DevicesForHubListSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/DevicesForHubListSamples.java new file mode 100644 index 000000000000..fc582ed600ac --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/DevicesForHubListSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for DevicesForHub List. */ +public final class DevicesForHubListSamples { + /** + * Sample code: Get Devices. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void getDevices(com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager + .devicesForHubs() + .list( + "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/MyGroup/providers/Microsoft.Devices/iotHubs/myHub", + null, + null, + null, + Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/DevicesForSubscriptionListSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/DevicesForSubscriptionListSamples.java new file mode 100644 index 000000000000..f8187d948e4b --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/DevicesForSubscriptionListSamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for DevicesForSubscription List. */ +public final class DevicesForSubscriptionListSamples { + /** + * Sample code: Get Devices. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void getDevices(com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager.devicesForSubscriptions().list(null, null, null, Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/DiscoveredSecuritySolutionsGetSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/DiscoveredSecuritySolutionsGetSamples.java new file mode 100644 index 000000000000..72a730fbc66c --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/DiscoveredSecuritySolutionsGetSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for DiscoveredSecuritySolutions Get. */ +public final class DiscoveredSecuritySolutionsGetSamples { + /** + * Sample code: Get discovered security solution from a security data location. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void getDiscoveredSecuritySolutionFromASecurityDataLocation( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager.discoveredSecuritySolutions().getWithResponse("myRg2", "centralus", "paloalto7", Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/DiscoveredSecuritySolutionsListByHomeRegionSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/DiscoveredSecuritySolutionsListByHomeRegionSamples.java new file mode 100644 index 000000000000..e7f1fd990581 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/DiscoveredSecuritySolutionsListByHomeRegionSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for DiscoveredSecuritySolutions ListByHomeRegion. */ +public final class DiscoveredSecuritySolutionsListByHomeRegionSamples { + /** + * Sample code: Get discovered security solutions from a security data location. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void getDiscoveredSecuritySolutionsFromASecurityDataLocation( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager.discoveredSecuritySolutions().listByHomeRegion("centralus", Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/DiscoveredSecuritySolutionsListSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/DiscoveredSecuritySolutionsListSamples.java new file mode 100644 index 000000000000..28db6da64956 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/DiscoveredSecuritySolutionsListSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for DiscoveredSecuritySolutions List. */ +public final class DiscoveredSecuritySolutionsListSamples { + /** + * Sample code: Get discovered security solutions. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void getDiscoveredSecuritySolutions( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager.discoveredSecuritySolutions().list(Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/ExternalSecuritySolutionsGetSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/ExternalSecuritySolutionsGetSamples.java new file mode 100644 index 000000000000..4037da239892 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/ExternalSecuritySolutionsGetSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for ExternalSecuritySolutions Get. */ +public final class ExternalSecuritySolutionsGetSamples { + /** + * Sample code: Get external security solution. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void getExternalSecuritySolution(com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager + .externalSecuritySolutions() + .getWithResponse( + "defaultresourcegroup-eus", + "centralus", + "aad_defaultworkspace-20ff7fc3-e762-44dd-bd96-b71116dcdc23-eus", + Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/ExternalSecuritySolutionsListByHomeRegionSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/ExternalSecuritySolutionsListByHomeRegionSamples.java new file mode 100644 index 000000000000..9912c79417fb --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/ExternalSecuritySolutionsListByHomeRegionSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for ExternalSecuritySolutions ListByHomeRegion. */ +public final class ExternalSecuritySolutionsListByHomeRegionSamples { + /** + * Sample code: Get external security solutions on a subscription from security data location. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void getExternalSecuritySolutionsOnASubscriptionFromSecurityDataLocation( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager.externalSecuritySolutions().listByHomeRegion("centralus", Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/ExternalSecuritySolutionsListSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/ExternalSecuritySolutionsListSamples.java new file mode 100644 index 000000000000..48ab7a09d10f --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/ExternalSecuritySolutionsListSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for ExternalSecuritySolutions List. */ +public final class ExternalSecuritySolutionsListSamples { + /** + * Sample code: Get external security solutions on a subscription. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void getExternalSecuritySolutionsOnASubscription( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager.externalSecuritySolutions().list(Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/InformationProtectionPoliciesCreateOrUpdateSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/InformationProtectionPoliciesCreateOrUpdateSamples.java new file mode 100644 index 000000000000..302f064f2457 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/InformationProtectionPoliciesCreateOrUpdateSamples.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.resourcemanager.security.models.InformationProtectionKeyword; +import com.azure.resourcemanager.security.models.InformationProtectionPoliciesInformationProtectionPolicyName; +import com.azure.resourcemanager.security.models.InformationType; +import com.azure.resourcemanager.security.models.SensitivityLabel; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +/** Samples for InformationProtectionPolicies CreateOrUpdate. */ +public final class InformationProtectionPoliciesCreateOrUpdateSamples { + /** + * Sample code: Create or update an information protection policy for a management group. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void createOrUpdateAnInformationProtectionPolicyForAManagementGroup( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager + .informationProtectionPolicies() + .define(InformationProtectionPoliciesInformationProtectionPolicyName.CUSTOM) + .withExistingScope("providers/Microsoft.Management/managementGroups/148059f7-faf3-49a6-ba35-85122112291e") + .withLabels( + mapOf( + "1345da73-bc5a-4a8f-b7dd-3820eb713da8", + new SensitivityLabel().withDisplayName("Public").withOrder(100).withEnabled(true), + "575739d2-3d53-4df0-9042-4c7772d5c7b1", + new SensitivityLabel().withDisplayName("Confidential").withOrder(300).withEnabled(true), + "7aa516c7-5a53-4857-bc6e-6808c6acd542", + new SensitivityLabel().withDisplayName("General").withOrder(200).withEnabled(true))) + .withInformationTypes( + mapOf( + "3bf35491-99b8-41f2-86d5-c1200a7df658", + new InformationType() + .withDisplayName("Custom") + .withOrder(1400) + .withRecommendedLabelId(UUID.fromString("7aa516c7-5a53-4857-bc6e-6808c6acd542")) + .withEnabled(true) + .withCustom(true) + .withKeywords( + Arrays + .asList( + new InformationProtectionKeyword() + .withPattern("%custom%") + .withCustom(true) + .withCanBeNumeric(true))), + "7fb9419d-2473-4ad8-8e11-b25cc8cf6a07", + new InformationType() + .withDisplayName("Networking") + .withOrder(100) + .withRecommendedLabelId(UUID.fromString("575739d2-3d53-4df0-9042-4c7772d5c7b1")) + .withEnabled(true) + .withCustom(false) + .withKeywords( + Arrays + .asList( + new InformationProtectionKeyword() + .withPattern("%networking%") + .withCustom(true) + .withCanBeNumeric(false))))) + .create(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/InformationProtectionPoliciesGetSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/InformationProtectionPoliciesGetSamples.java new file mode 100644 index 000000000000..1892817035b4 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/InformationProtectionPoliciesGetSamples.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.models.InformationProtectionPoliciesInformationProtectionPolicyName; + +/** Samples for InformationProtectionPolicies Get. */ +public final class InformationProtectionPoliciesGetSamples { + /** + * Sample code: Get the customized information protection policy for a management group. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void getTheCustomizedInformationProtectionPolicyForAManagementGroup( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager + .informationProtectionPolicies() + .getWithResponse( + "providers/Microsoft.Management/managementGroups/148059f7-faf3-49a6-ba35-85122112291e", + InformationProtectionPoliciesInformationProtectionPolicyName.CUSTOM, + Context.NONE); + } + + /** + * Sample code: Get the effective information protection policy for a management group. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void getTheEffectiveInformationProtectionPolicyForAManagementGroup( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager + .informationProtectionPolicies() + .getWithResponse( + "providers/Microsoft.Management/managementGroups/148059f7-faf3-49a6-ba35-85122112291e", + InformationProtectionPoliciesInformationProtectionPolicyName.EFFECTIVE, + Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/InformationProtectionPoliciesListSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/InformationProtectionPoliciesListSamples.java new file mode 100644 index 000000000000..ae86d7fba7ae --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/InformationProtectionPoliciesListSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for InformationProtectionPolicies List. */ +public final class InformationProtectionPoliciesListSamples { + /** + * Sample code: Get information protection policies. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void getInformationProtectionPolicies( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager + .informationProtectionPolicies() + .list("providers/Microsoft.Management/managementGroups/148059f7-faf3-49a6-ba35-85122112291e", Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IngestionSettingsCreateSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IngestionSettingsCreateSamples.java new file mode 100644 index 000000000000..cd2dc021468d --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IngestionSettingsCreateSamples.java @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +/** Samples for IngestionSettings Create. */ +public final class IngestionSettingsCreateSamples { + /** + * Sample code: Create an ingestion setting for subscription. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void createAnIngestionSettingForSubscription( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager.ingestionSettings().define("default").create(); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IngestionSettingsDeleteSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IngestionSettingsDeleteSamples.java new file mode 100644 index 000000000000..f9d9e84a733a --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IngestionSettingsDeleteSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for IngestionSettings Delete. */ +public final class IngestionSettingsDeleteSamples { + /** + * Sample code: Delete an ingestion setting for the subscription. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void deleteAnIngestionSettingForTheSubscription( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager.ingestionSettings().deleteWithResponse("default", Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IngestionSettingsGetSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IngestionSettingsGetSamples.java new file mode 100644 index 000000000000..45cc1459f570 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IngestionSettingsGetSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for IngestionSettings Get. */ +public final class IngestionSettingsGetSamples { + /** + * Sample code: Get a ingestion setting on subscription. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void getAIngestionSettingOnSubscription( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager.ingestionSettings().getWithResponse("default", Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IngestionSettingsListConnectionStringsSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IngestionSettingsListConnectionStringsSamples.java new file mode 100644 index 000000000000..8a37257f9de1 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IngestionSettingsListConnectionStringsSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for IngestionSettings ListConnectionStrings. */ +public final class IngestionSettingsListConnectionStringsSamples { + /** + * Sample code: List connection strings for ingesting security data and logs. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void listConnectionStringsForIngestingSecurityDataAndLogs( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager.ingestionSettings().listConnectionStringsWithResponse("default", Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IngestionSettingsListSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IngestionSettingsListSamples.java new file mode 100644 index 000000000000..b1f9e1617707 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IngestionSettingsListSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for IngestionSettings List. */ +public final class IngestionSettingsListSamples { + /** + * Sample code: Get ingestion settings on subscription. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void getIngestionSettingsOnSubscription( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager.ingestionSettings().list(Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IngestionSettingsListTokensSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IngestionSettingsListTokensSamples.java new file mode 100644 index 000000000000..c1c4f2e63867 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IngestionSettingsListTokensSamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for IngestionSettings ListTokens. */ +public final class IngestionSettingsListTokensSamples { + /** + * Sample code: List ingestion setting tokens. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void listIngestionSettingTokens(com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager.ingestionSettings().listTokensWithResponse("default", Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotAlertTypesGetSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotAlertTypesGetSamples.java new file mode 100644 index 000000000000..24879ed4aed6 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotAlertTypesGetSamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for IotAlertTypes Get. */ +public final class IotAlertTypesGetSamples { + /** + * Sample code: Get IoT Alert Type. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void getIoTAlertType(com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager.iotAlertTypes().getWithResponse("IoT_PrivilegedContainer", Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotAlertTypesListSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotAlertTypesListSamples.java new file mode 100644 index 000000000000..e61b455e14b6 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotAlertTypesListSamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for IotAlertTypes List. */ +public final class IotAlertTypesListSamples { + /** + * Sample code: Get IoT Alert Types. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void getIoTAlertTypes(com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager.iotAlertTypes().listWithResponse(Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotAlertsGetSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotAlertsGetSamples.java new file mode 100644 index 000000000000..60f2c4c170b6 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotAlertsGetSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for IotAlerts Get. */ +public final class IotAlertsGetSamples { + /** + * Sample code: Get IoT Alert. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void getIoTAlert(com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager + .iotAlerts() + .getWithResponse( + "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myGroup/providers/Microsoft.Devices/IotHubs/myIotHub", + "903e76ff-17eb-4bac-ac8a-2bc31ab68fd8", + Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotAlertsListSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotAlertsListSamples.java new file mode 100644 index 000000000000..1f67f3a03cbc --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotAlertsListSamples.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for IotAlerts List. */ +public final class IotAlertsListSamples { + /** + * Sample code: List IoT Alerts. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void listIoTAlerts(com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager + .iotAlerts() + .list( + "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myGroup/providers/Microsoft.Devices/IotHubs/myIotHub", + "2020-05-12T06:32:25Z", + "2020-05-14T06:32:25Z", + "IoT_PrivilegedContainer", + null, + "device-1", + 1, + null, + Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotDefenderSettingsCreateOrUpdateSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotDefenderSettingsCreateOrUpdateSamples.java new file mode 100644 index 000000000000..153eaa5c6cf5 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotDefenderSettingsCreateOrUpdateSamples.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.IotDefenderSettingsModelInner; +import com.azure.resourcemanager.security.models.OnboardingKind; +import java.util.Arrays; + +/** Samples for IotDefenderSettings CreateOrUpdate. */ +public final class IotDefenderSettingsCreateOrUpdateSamples { + /** + * Sample code: Create or update IoT Defender settings. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void createOrUpdateIoTDefenderSettings( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager + .iotDefenderSettings() + .createOrUpdateWithResponse( + new IotDefenderSettingsModelInner() + .withDeviceQuota(2000) + .withSentinelWorkspaceResourceIds( + Arrays + .asList( + "/subscriptions/c4930e90-cd72-4aa5-93e9-2d081d129569/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace1")) + .withOnboardingKind(OnboardingKind.DEFAULT), + Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotDefenderSettingsDeleteSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotDefenderSettingsDeleteSamples.java new file mode 100644 index 000000000000..81925420fcbb --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotDefenderSettingsDeleteSamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for IotDefenderSettings Delete. */ +public final class IotDefenderSettingsDeleteSamples { + /** + * Sample code: Delete IoT Defender settings. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void deleteIoTDefenderSettings(com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager.iotDefenderSettings().deleteWithResponse(Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotDefenderSettingsDownloadManagerActivationSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotDefenderSettingsDownloadManagerActivationSamples.java new file mode 100644 index 000000000000..23e4e40e92e4 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotDefenderSettingsDownloadManagerActivationSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for IotDefenderSettings DownloadManagerActivation. */ +public final class IotDefenderSettingsDownloadManagerActivationSamples { + /** + * Sample code: Download quota data of the subscription. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void downloadQuotaDataOfTheSubscription( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager.iotDefenderSettings().downloadManagerActivationWithResponse(Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotDefenderSettingsGetSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotDefenderSettingsGetSamples.java new file mode 100644 index 000000000000..c3627e773e03 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotDefenderSettingsGetSamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for IotDefenderSettings Get. */ +public final class IotDefenderSettingsGetSamples { + /** + * Sample code: Get IoT Defender settings. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void getIoTDefenderSettings(com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager.iotDefenderSettings().getWithResponse(Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotDefenderSettingsListSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotDefenderSettingsListSamples.java new file mode 100644 index 000000000000..11890b702fb2 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotDefenderSettingsListSamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for IotDefenderSettings List. */ +public final class IotDefenderSettingsListSamples { + /** + * Sample code: List IoT Defender settings. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void listIoTDefenderSettings(com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager.iotDefenderSettings().listWithResponse(Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotDefenderSettingsPackageDownloadsSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotDefenderSettingsPackageDownloadsSamples.java new file mode 100644 index 000000000000..1529def74d7b --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotDefenderSettingsPackageDownloadsSamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for IotDefenderSettings PackageDownloads. */ +public final class IotDefenderSettingsPackageDownloadsSamples { + /** + * Sample code: Package downloads. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void packageDownloads(com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager.iotDefenderSettings().packageDownloadsWithResponse(Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotRecommendationTypesGetSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotRecommendationTypesGetSamples.java new file mode 100644 index 000000000000..4b79a23a5715 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotRecommendationTypesGetSamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for IotRecommendationTypes Get. */ +public final class IotRecommendationTypesGetSamples { + /** + * Sample code: Get IoT Recommendation Type. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void getIoTRecommendationType(com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager.iotRecommendationTypes().getWithResponse("IoT_VulnerableTLSCipherSuite", Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotRecommendationTypesListSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotRecommendationTypesListSamples.java new file mode 100644 index 000000000000..22b48bdfb08a --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotRecommendationTypesListSamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for IotRecommendationTypes List. */ +public final class IotRecommendationTypesListSamples { + /** + * Sample code: Get IoT Recommendation Types. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void getIoTRecommendationTypes(com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager.iotRecommendationTypes().listWithResponse(Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotRecommendationsGetSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotRecommendationsGetSamples.java new file mode 100644 index 000000000000..f263bb6a4f44 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotRecommendationsGetSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for IotRecommendations Get. */ +public final class IotRecommendationsGetSamples { + /** + * Sample code: Get IoT Recommendation. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void getIoTRecommendation(com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager + .iotRecommendations() + .getWithResponse( + "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myGroup/providers/Microsoft.Devices/IotHubs/myIotHub", + "903e76ff-17eb-4bac-ac8a-2bc31ab68fd8", + Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotRecommendationsListSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotRecommendationsListSamples.java new file mode 100644 index 000000000000..dbce2d71a170 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotRecommendationsListSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for IotRecommendations List. */ +public final class IotRecommendationsListSamples { + /** + * Sample code: Get IoT Recommendations. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void getIoTRecommendations(com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager + .iotRecommendations() + .list( + "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myGroup/providers/Microsoft.Devices/IotHubs/myIotHub", + "IoT_Baseline", + "device-1", + 1, + null, + Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotSecuritySolutionAnalyticsGetSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotSecuritySolutionAnalyticsGetSamples.java new file mode 100644 index 000000000000..4642868787e0 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotSecuritySolutionAnalyticsGetSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for IotSecuritySolutionAnalytics Get. */ +public final class IotSecuritySolutionAnalyticsGetSamples { + /** + * Sample code: Get Security Solution Analytics. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void getSecuritySolutionAnalytics( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager.iotSecuritySolutionAnalytics().getWithResponse("MyGroup", "default", Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotSecuritySolutionAnalyticsListSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotSecuritySolutionAnalyticsListSamples.java new file mode 100644 index 000000000000..cec08a427ba0 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotSecuritySolutionAnalyticsListSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for IotSecuritySolutionAnalytics List. */ +public final class IotSecuritySolutionAnalyticsListSamples { + /** + * Sample code: Get Security Solution Analytics. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void getSecuritySolutionAnalytics( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager.iotSecuritySolutionAnalytics().listWithResponse("MyGroup", "default", Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotSecuritySolutionCreateOrUpdateSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotSecuritySolutionCreateOrUpdateSamples.java new file mode 100644 index 000000000000..87f966cfdd6f --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotSecuritySolutionCreateOrUpdateSamples.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.resourcemanager.security.models.RecommendationConfigStatus; +import com.azure.resourcemanager.security.models.RecommendationConfigurationProperties; +import com.azure.resourcemanager.security.models.RecommendationType; +import com.azure.resourcemanager.security.models.SecuritySolutionStatus; +import com.azure.resourcemanager.security.models.UnmaskedIpLoggingStatus; +import com.azure.resourcemanager.security.models.UserDefinedResourcesProperties; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for IotSecuritySolution CreateOrUpdate. */ +public final class IotSecuritySolutionCreateOrUpdateSamples { + /** + * Sample code: Create or update a IoT security solution. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void createOrUpdateAIoTSecuritySolution( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager + .iotSecuritySolutions() + .define("default") + .withExistingResourceGroup("MyGroup") + .withRegion("East Us") + .withTags(mapOf()) + .withWorkspace( + "/subscriptions/c4930e90-cd72-4aa5-93e9-2d081d129569/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace1") + .withDisplayName("Solution Default") + .withStatus(SecuritySolutionStatus.ENABLED) + .withExport(Arrays.asList()) + .withDisabledDataSources(Arrays.asList()) + .withIotHubs( + Arrays + .asList( + "/subscriptions/075423e9-7d33-4166-8bdf-3920b04e3735/resourceGroups/myRg/providers/Microsoft.Devices/IotHubs/FirstIotHub")) + .withUserDefinedResources( + new UserDefinedResourcesProperties() + .withQuery("where type != \"microsoft.devices/iothubs\" | where name contains \"iot\"") + .withQuerySubscriptions(Arrays.asList("075423e9-7d33-4166-8bdf-3920b04e3735"))) + .withRecommendationsConfiguration( + Arrays + .asList( + new RecommendationConfigurationProperties() + .withRecommendationType(RecommendationType.IO_T_OPEN_PORTS) + .withStatus(RecommendationConfigStatus.DISABLED), + new RecommendationConfigurationProperties() + .withRecommendationType(RecommendationType.IO_T_SHARED_CREDENTIALS) + .withStatus(RecommendationConfigStatus.DISABLED))) + .withUnmaskedIpLoggingStatus(UnmaskedIpLoggingStatus.ENABLED) + .create(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotSecuritySolutionDeleteSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotSecuritySolutionDeleteSamples.java new file mode 100644 index 000000000000..f0600963ce35 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotSecuritySolutionDeleteSamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for IotSecuritySolution Delete. */ +public final class IotSecuritySolutionDeleteSamples { + /** + * Sample code: Delete an IoT security solution. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void deleteAnIoTSecuritySolution(com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager.iotSecuritySolutions().deleteWithResponse("MyGroup", "default", Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotSecuritySolutionGetByResourceGroupSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotSecuritySolutionGetByResourceGroupSamples.java new file mode 100644 index 000000000000..ed945a50d5c1 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotSecuritySolutionGetByResourceGroupSamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for IotSecuritySolution GetByResourceGroup. */ +public final class IotSecuritySolutionGetByResourceGroupSamples { + /** + * Sample code: Get a IoT security solution. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void getAIoTSecuritySolution(com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager.iotSecuritySolutions().getByResourceGroupWithResponse("MyGroup", "default", Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotSecuritySolutionListByResourceGroupSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotSecuritySolutionListByResourceGroupSamples.java new file mode 100644 index 000000000000..eb3aa2b24ddd --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotSecuritySolutionListByResourceGroupSamples.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for IotSecuritySolution ListByResourceGroup. */ +public final class IotSecuritySolutionListByResourceGroupSamples { + /** + * Sample code: List IoT Security solutions by resource group and IoT Hub. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void listIoTSecuritySolutionsByResourceGroupAndIoTHub( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager + .iotSecuritySolutions() + .listByResourceGroup( + "MyRg", + "properties.iotHubs/any(i eq" + + " \"/subscriptions/075423e9-7d33-4166-8bdf-3920b04e3735/resourceGroups/myRg/providers/Microsoft.Devices/IotHubs/FirstIotHub\")", + Context.NONE); + } + + /** + * Sample code: List IoT Security solutions by resource group. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void listIoTSecuritySolutionsByResourceGroup( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager.iotSecuritySolutions().listByResourceGroup("MyGroup", null, Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotSecuritySolutionListSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotSecuritySolutionListSamples.java new file mode 100644 index 000000000000..3a0c7317723b --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotSecuritySolutionListSamples.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for IotSecuritySolution List. */ +public final class IotSecuritySolutionListSamples { + /** + * Sample code: List IoT Security solutions by subscription. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void listIoTSecuritySolutionsBySubscription( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager.iotSecuritySolutions().list(null, Context.NONE); + } + + /** + * Sample code: List IoT Security solutions by IoT Hub. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void listIoTSecuritySolutionsByIoTHub( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager + .iotSecuritySolutions() + .list( + "properties.iotHubs/any(i eq" + + " \"/subscriptions/075423e9-7d33-4166-8bdf-3920b04e3735/resourceGroups/myRg/providers/Microsoft.Devices/IotHubs/FirstIotHub\")", + Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotSecuritySolutionUpdateSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotSecuritySolutionUpdateSamples.java new file mode 100644 index 000000000000..5dca3cda751a --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotSecuritySolutionUpdateSamples.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.models.IoTSecuritySolutionModel; +import com.azure.resourcemanager.security.models.RecommendationConfigStatus; +import com.azure.resourcemanager.security.models.RecommendationConfigurationProperties; +import com.azure.resourcemanager.security.models.RecommendationType; +import com.azure.resourcemanager.security.models.UserDefinedResourcesProperties; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for IotSecuritySolution Update. */ +public final class IotSecuritySolutionUpdateSamples { + /** + * Sample code: Use this method to update existing IoT Security solution. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void useThisMethodToUpdateExistingIoTSecuritySolution( + com.azure.resourcemanager.security.SecurityManager securityManager) { + IoTSecuritySolutionModel resource = + securityManager + .iotSecuritySolutions() + .getByResourceGroupWithResponse("myRg", "default", Context.NONE) + .getValue(); + resource + .update() + .withTags(mapOf("foo", "bar")) + .withUserDefinedResources( + new UserDefinedResourcesProperties() + .withQuery("where type != \"microsoft.devices/iothubs\" | where name contains \"v2\"") + .withQuerySubscriptions(Arrays.asList("075423e9-7d33-4166-8bdf-3920b04e3735"))) + .withRecommendationsConfiguration( + Arrays + .asList( + new RecommendationConfigurationProperties() + .withRecommendationType(RecommendationType.IO_T_OPEN_PORTS) + .withStatus(RecommendationConfigStatus.DISABLED), + new RecommendationConfigurationProperties() + .withRecommendationType(RecommendationType.IO_T_SHARED_CREDENTIALS) + .withStatus(RecommendationConfigStatus.DISABLED))) + .apply(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotSecuritySolutionsAnalyticsAggregatedAlertDismissSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotSecuritySolutionsAnalyticsAggregatedAlertDismissSamples.java new file mode 100644 index 000000000000..ea59f30cb66f --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotSecuritySolutionsAnalyticsAggregatedAlertDismissSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for IotSecuritySolutionsAnalyticsAggregatedAlert Dismiss. */ +public final class IotSecuritySolutionsAnalyticsAggregatedAlertDismissSamples { + /** + * Sample code: Dismiss an aggregated IoT Security Solution Alert. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void dismissAnAggregatedIoTSecuritySolutionAlert( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager + .iotSecuritySolutionsAnalyticsAggregatedAlerts() + .dismissWithResponse("IoTEdgeResources", "default", "IoT_Bruteforce_Fail/2019-02-02/dismiss", Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotSecuritySolutionsAnalyticsAggregatedAlertGetSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotSecuritySolutionsAnalyticsAggregatedAlertGetSamples.java new file mode 100644 index 000000000000..0a70c532e187 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotSecuritySolutionsAnalyticsAggregatedAlertGetSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for IotSecuritySolutionsAnalyticsAggregatedAlert Get. */ +public final class IotSecuritySolutionsAnalyticsAggregatedAlertGetSamples { + /** + * Sample code: Get the aggregated security analytics alert of yours IoT Security solution. This aggregation is + * performed by alert name. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void + getTheAggregatedSecurityAnalyticsAlertOfYoursIoTSecuritySolutionThisAggregationIsPerformedByAlertName( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager + .iotSecuritySolutionsAnalyticsAggregatedAlerts() + .getWithResponse("MyGroup", "default", "IoT_Bruteforce_Fail/2019-02-02", Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotSecuritySolutionsAnalyticsAggregatedAlertListSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotSecuritySolutionsAnalyticsAggregatedAlertListSamples.java new file mode 100644 index 000000000000..a68339927781 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotSecuritySolutionsAnalyticsAggregatedAlertListSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for IotSecuritySolutionsAnalyticsAggregatedAlert List. */ +public final class IotSecuritySolutionsAnalyticsAggregatedAlertListSamples { + /** + * Sample code: Get the aggregated alert list of yours IoT Security solution. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void getTheAggregatedAlertListOfYoursIoTSecuritySolution( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager.iotSecuritySolutionsAnalyticsAggregatedAlerts().list("MyGroup", "default", null, Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotSecuritySolutionsAnalyticsRecommendationGetSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotSecuritySolutionsAnalyticsRecommendationGetSamples.java new file mode 100644 index 000000000000..3489f2cc9db6 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotSecuritySolutionsAnalyticsRecommendationGetSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for IotSecuritySolutionsAnalyticsRecommendation Get. */ +public final class IotSecuritySolutionsAnalyticsRecommendationGetSamples { + /** + * Sample code: Get the aggregated security analytics recommendation of yours IoT Security solution. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void getTheAggregatedSecurityAnalyticsRecommendationOfYoursIoTSecuritySolution( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager + .iotSecuritySolutionsAnalyticsRecommendations() + .getWithResponse("IoTEdgeResources", "default", "OpenPortsOnDevice", Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotSecuritySolutionsAnalyticsRecommendationListSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotSecuritySolutionsAnalyticsRecommendationListSamples.java new file mode 100644 index 000000000000..01f29343e7f1 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotSecuritySolutionsAnalyticsRecommendationListSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for IotSecuritySolutionsAnalyticsRecommendation List. */ +public final class IotSecuritySolutionsAnalyticsRecommendationListSamples { + /** + * Sample code: Get the list of aggregated security analytics recommendations of yours IoT Security solution. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void getTheListOfAggregatedSecurityAnalyticsRecommendationsOfYoursIoTSecuritySolution( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager + .iotSecuritySolutionsAnalyticsRecommendations() + .list("IoTEdgeResources", "default", null, Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotSensorsCreateOrUpdateSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotSensorsCreateOrUpdateSamples.java new file mode 100644 index 000000000000..682b79417f82 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotSensorsCreateOrUpdateSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.resourcemanager.security.models.SensorType; + +/** Samples for IotSensors CreateOrUpdate. */ +public final class IotSensorsCreateOrUpdateSamples { + /** + * Sample code: Create or update IoT sensor. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void createOrUpdateIoTSensor(com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager + .iotSensors() + .define("mySensor") + .withExistingScope( + "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.Devices/IotHubs/myHub") + .withTiAutomaticUpdates(true) + .withZone("Zone Name") + .withSensorType(SensorType.OT) + .create(); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotSensorsDeleteSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotSensorsDeleteSamples.java new file mode 100644 index 000000000000..6f7544ae3927 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotSensorsDeleteSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for IotSensors Delete. */ +public final class IotSensorsDeleteSamples { + /** + * Sample code: Delete IoT sensor. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void deleteIoTSensor(com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager + .iotSensors() + .deleteWithResponse( + "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.Devices/IotHubs/myHub", + "mySensor", + Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotSensorsDownloadActivationSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotSensorsDownloadActivationSamples.java new file mode 100644 index 000000000000..cb4a2d3485ed --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotSensorsDownloadActivationSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for IotSensors DownloadActivation. */ +public final class IotSensorsDownloadActivationSamples { + /** + * Sample code: Download activation file. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void downloadActivationFile(com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager + .iotSensors() + .downloadActivationWithResponse( + "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.Devices/IotHubs/myHub", + "mySensor", + Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotSensorsDownloadResetPasswordSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotSensorsDownloadResetPasswordSamples.java new file mode 100644 index 000000000000..9391e038d43e --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotSensorsDownloadResetPasswordSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.models.ResetPasswordInput; + +/** Samples for IotSensors DownloadResetPassword. */ +public final class IotSensorsDownloadResetPasswordSamples { + /** + * Sample code: Download file for reset password of the sensor. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void downloadFileForResetPasswordOfTheSensor( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager + .iotSensors() + .downloadResetPasswordWithResponse( + "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.Devices/IotHubs/myHub", + "mySensor", + new ResetPasswordInput().withApplianceId("3214-528AV23-D121-D3-E1"), + Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotSensorsGetSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotSensorsGetSamples.java new file mode 100644 index 000000000000..10f599c4f262 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotSensorsGetSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for IotSensors Get. */ +public final class IotSensorsGetSamples { + /** + * Sample code: Get IoT sensor. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void getIoTSensor(com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager + .iotSensors() + .getWithResponse( + "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.Devices/IotHubs/myHub", + "mySensor", + Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotSensorsListSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotSensorsListSamples.java new file mode 100644 index 000000000000..278adafdf475 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotSensorsListSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for IotSensors List. */ +public final class IotSensorsListSamples { + /** + * Sample code: List IoT sensors. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void listIoTSensors(com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager + .iotSensors() + .listWithResponse( + "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.Devices/IotHubs/myHub", + Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotSensorsTriggerTiPackageUpdateSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotSensorsTriggerTiPackageUpdateSamples.java new file mode 100644 index 000000000000..99992f345ee1 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotSensorsTriggerTiPackageUpdateSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for IotSensors TriggerTiPackageUpdate. */ +public final class IotSensorsTriggerTiPackageUpdateSamples { + /** + * Sample code: Trigger threat intelligence package update. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void triggerThreatIntelligencePackageUpdate( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager + .iotSensors() + .triggerTiPackageUpdateWithResponse( + "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.Devices/IotHubs/myHub", + "mySensor", + Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotSitesCreateOrUpdateSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotSitesCreateOrUpdateSamples.java new file mode 100644 index 000000000000..3893e87887cc --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotSitesCreateOrUpdateSamples.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.IotSitesModelInner; +import java.util.HashMap; +import java.util.Map; + +/** Samples for IotSites CreateOrUpdate. */ +public final class IotSitesCreateOrUpdateSamples { + /** + * Sample code: Create or update IoT site. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void createOrUpdateIoTSite(com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager + .iotSites() + .createOrUpdateWithResponse( + "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.Devices/IotHubs/myHub", + new IotSitesModelInner() + .withDisplayName("IoT site name") + .withTags(mapOf("key1", "value1", "key2", "value2")), + Context.NONE); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotSitesDeleteSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotSitesDeleteSamples.java new file mode 100644 index 000000000000..2d78d9d27514 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotSitesDeleteSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for IotSites Delete. */ +public final class IotSitesDeleteSamples { + /** + * Sample code: Delete IoT site. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void deleteIoTSite(com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager + .iotSites() + .deleteWithResponse( + "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.Devices/IotHubs/myHub", + Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotSitesGetSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotSitesGetSamples.java new file mode 100644 index 000000000000..59ac6f43a72d --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotSitesGetSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for IotSites Get. */ +public final class IotSitesGetSamples { + /** + * Sample code: Get IoT site. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void getIoTSite(com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager + .iotSites() + .getWithResponse( + "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.Devices/IotHubs/myHub", + Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotSitesListSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotSitesListSamples.java new file mode 100644 index 000000000000..a354baf95fb6 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/IotSitesListSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for IotSites List. */ +public final class IotSitesListSamples { + /** + * Sample code: List IoT sites. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void listIoTSites(com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager + .iotSites() + .listWithResponse( + "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.Devices/IotHubs/myHub/iotSites", + Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/JitNetworkAccessPoliciesCreateOrUpdateSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/JitNetworkAccessPoliciesCreateOrUpdateSamples.java new file mode 100644 index 000000000000..bf559ca05268 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/JitNetworkAccessPoliciesCreateOrUpdateSamples.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.resourcemanager.security.fluent.models.JitNetworkAccessRequestInner; +import com.azure.resourcemanager.security.models.JitNetworkAccessPolicyVirtualMachine; +import com.azure.resourcemanager.security.models.JitNetworkAccessPortRule; +import com.azure.resourcemanager.security.models.JitNetworkAccessRequestPort; +import com.azure.resourcemanager.security.models.JitNetworkAccessRequestVirtualMachine; +import com.azure.resourcemanager.security.models.ProtocolValue; +import com.azure.resourcemanager.security.models.Status; +import com.azure.resourcemanager.security.models.StatusReason; +import java.time.OffsetDateTime; +import java.util.Arrays; + +/** Samples for JitNetworkAccessPolicies CreateOrUpdate. */ +public final class JitNetworkAccessPoliciesCreateOrUpdateSamples { + /** + * Sample code: Create JIT network access policy. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void createJITNetworkAccessPolicy( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager + .jitNetworkAccessPolicies() + .define("default") + .withExistingLocation("myRg1", "westeurope") + .withVirtualMachines( + Arrays + .asList( + new JitNetworkAccessPolicyVirtualMachine() + .withId( + "/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg1/providers/Microsoft.Compute/virtualMachines/vm1") + .withPorts( + Arrays + .asList( + new JitNetworkAccessPortRule() + .withNumber(22) + .withProtocol(ProtocolValue.ASTERISK) + .withAllowedSourceAddressPrefix("*") + .withMaxRequestAccessDuration("PT3H"), + new JitNetworkAccessPortRule() + .withNumber(3389) + .withProtocol(ProtocolValue.ASTERISK) + .withAllowedSourceAddressPrefix("*") + .withMaxRequestAccessDuration("PT3H"))))) + .withRequests( + Arrays + .asList( + new JitNetworkAccessRequestInner() + .withVirtualMachines( + Arrays + .asList( + new JitNetworkAccessRequestVirtualMachine() + .withId( + "/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg1/providers/Microsoft.Compute/virtualMachines/vm1") + .withPorts( + Arrays + .asList( + new JitNetworkAccessRequestPort() + .withNumber(3389) + .withAllowedSourceAddressPrefix("192.127.0.2") + .withEndTimeUtc( + OffsetDateTime.parse("2018-05-17T09:06:45.5691611Z")) + .withStatus(Status.INITIATED) + .withStatusReason(StatusReason.USER_REQUESTED))))) + .withStartTimeUtc(OffsetDateTime.parse("2018-05-17T08:06:45.5691611Z")) + .withRequestor("barbara@contoso.com"))) + .withKind("Basic") + .create(); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/JitNetworkAccessPoliciesDeleteSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/JitNetworkAccessPoliciesDeleteSamples.java new file mode 100644 index 000000000000..ac94ddbc9659 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/JitNetworkAccessPoliciesDeleteSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for JitNetworkAccessPolicies Delete. */ +public final class JitNetworkAccessPoliciesDeleteSamples { + /** + * Sample code: Delete a JIT network access policy. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void deleteAJITNetworkAccessPolicy( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager.jitNetworkAccessPolicies().deleteWithResponse("myRg1", "westeurope", "default", Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/JitNetworkAccessPoliciesGetSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/JitNetworkAccessPoliciesGetSamples.java new file mode 100644 index 000000000000..ce7349262ca7 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/JitNetworkAccessPoliciesGetSamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for JitNetworkAccessPolicies Get. */ +public final class JitNetworkAccessPoliciesGetSamples { + /** + * Sample code: Get JIT network access policy. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void getJITNetworkAccessPolicy(com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager.jitNetworkAccessPolicies().getWithResponse("myRg1", "westeurope", "default", Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/JitNetworkAccessPoliciesInitiateSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/JitNetworkAccessPoliciesInitiateSamples.java new file mode 100644 index 000000000000..43649aef6b62 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/JitNetworkAccessPoliciesInitiateSamples.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.models.JitNetworkAccessPolicyInitiatePort; +import com.azure.resourcemanager.security.models.JitNetworkAccessPolicyInitiateRequest; +import com.azure.resourcemanager.security.models.JitNetworkAccessPolicyInitiateVirtualMachine; +import java.util.Arrays; + +/** Samples for JitNetworkAccessPolicies Initiate. */ +public final class JitNetworkAccessPoliciesInitiateSamples { + /** + * Sample code: Initiate an action on a JIT network access policy. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void initiateAnActionOnAJITNetworkAccessPolicy( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager + .jitNetworkAccessPolicies() + .initiateWithResponse( + "myRg1", + "westeurope", + "default", + new JitNetworkAccessPolicyInitiateRequest() + .withVirtualMachines( + Arrays + .asList( + new JitNetworkAccessPolicyInitiateVirtualMachine() + .withId( + "/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg1/providers/Microsoft.Compute/virtualMachines/vm1") + .withPorts( + Arrays + .asList( + new JitNetworkAccessPolicyInitiatePort() + .withNumber(3389) + .withAllowedSourceAddressPrefix("192.127.0.2"))))) + .withJustification("testing a new version of the product"), + Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/JitNetworkAccessPoliciesListByRegionSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/JitNetworkAccessPoliciesListByRegionSamples.java new file mode 100644 index 000000000000..0f8fc45db0b0 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/JitNetworkAccessPoliciesListByRegionSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for JitNetworkAccessPolicies ListByRegion. */ +public final class JitNetworkAccessPoliciesListByRegionSamples { + /** + * Sample code: Get JIT network access policies on a subscription from a security data location. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void getJITNetworkAccessPoliciesOnASubscriptionFromASecurityDataLocation( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager.jitNetworkAccessPolicies().listByRegion("westeurope", Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/JitNetworkAccessPoliciesListByResourceGroupAndRegionSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/JitNetworkAccessPoliciesListByResourceGroupAndRegionSamples.java new file mode 100644 index 000000000000..e6f026cb04e5 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/JitNetworkAccessPoliciesListByResourceGroupAndRegionSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for JitNetworkAccessPolicies ListByResourceGroupAndRegion. */ +public final class JitNetworkAccessPoliciesListByResourceGroupAndRegionSamples { + /** + * Sample code: Get JIT network access policies on a resource group from a security data location. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void getJITNetworkAccessPoliciesOnAResourceGroupFromASecurityDataLocation( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager.jitNetworkAccessPolicies().listByResourceGroupAndRegion("myRg1", "westeurope", Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/JitNetworkAccessPoliciesListByResourceGroupSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/JitNetworkAccessPoliciesListByResourceGroupSamples.java new file mode 100644 index 000000000000..f72d5fd8f1dc --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/JitNetworkAccessPoliciesListByResourceGroupSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for JitNetworkAccessPolicies ListByResourceGroup. */ +public final class JitNetworkAccessPoliciesListByResourceGroupSamples { + /** + * Sample code: Get JIT network access policies on a resource group. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void getJITNetworkAccessPoliciesOnAResourceGroup( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager.jitNetworkAccessPolicies().listByResourceGroup("myRg1", Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/JitNetworkAccessPoliciesListSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/JitNetworkAccessPoliciesListSamples.java new file mode 100644 index 000000000000..dc07fc66348a --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/JitNetworkAccessPoliciesListSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for JitNetworkAccessPolicies List. */ +public final class JitNetworkAccessPoliciesListSamples { + /** + * Sample code: Get JIT network access policies on a subscription. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void getJITNetworkAccessPoliciesOnASubscription( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager.jitNetworkAccessPolicies().list(Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/LocationsGetSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/LocationsGetSamples.java new file mode 100644 index 000000000000..faa57df79bab --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/LocationsGetSamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for Locations Get. */ +public final class LocationsGetSamples { + /** + * Sample code: Get security data location. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void getSecurityDataLocation(com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager.locations().getWithResponse("centralus", Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/LocationsListSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/LocationsListSamples.java new file mode 100644 index 000000000000..b81a22baab76 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/LocationsListSamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for Locations List. */ +public final class LocationsListSamples { + /** + * Sample code: Get security data locations. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void getSecurityDataLocations(com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager.locations().list(Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/OnPremiseIotSensorsCreateOrUpdateSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/OnPremiseIotSensorsCreateOrUpdateSamples.java new file mode 100644 index 000000000000..a692138b096d --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/OnPremiseIotSensorsCreateOrUpdateSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for OnPremiseIotSensors CreateOrUpdate. */ +public final class OnPremiseIotSensorsCreateOrUpdateSamples { + /** + * Sample code: Create or update on-premise IoT sensor. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void createOrUpdateOnPremiseIoTSensor( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager.onPremiseIotSensors().createOrUpdateWithResponse("mySensor", Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/OnPremiseIotSensorsDeleteSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/OnPremiseIotSensorsDeleteSamples.java new file mode 100644 index 000000000000..4c5e7fe5f417 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/OnPremiseIotSensorsDeleteSamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for OnPremiseIotSensors Delete. */ +public final class OnPremiseIotSensorsDeleteSamples { + /** + * Sample code: Delete on-premise IoT sensor. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void deleteOnPremiseIoTSensor(com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager.onPremiseIotSensors().deleteWithResponse("mySensor", Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/OnPremiseIotSensorsDownloadActivationSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/OnPremiseIotSensorsDownloadActivationSamples.java new file mode 100644 index 000000000000..e6ae685eb165 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/OnPremiseIotSensorsDownloadActivationSamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for OnPremiseIotSensors DownloadActivation. */ +public final class OnPremiseIotSensorsDownloadActivationSamples { + /** + * Sample code: Download activation file. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void downloadActivationFile(com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager.onPremiseIotSensors().downloadActivationWithResponse("mySensor", Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/OnPremiseIotSensorsDownloadResetPasswordSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/OnPremiseIotSensorsDownloadResetPasswordSamples.java new file mode 100644 index 000000000000..7d1fa3b3f8a8 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/OnPremiseIotSensorsDownloadResetPasswordSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.models.ResetPasswordInput; + +/** Samples for OnPremiseIotSensors DownloadResetPassword. */ +public final class OnPremiseIotSensorsDownloadResetPasswordSamples { + /** + * Sample code: Download file for reset password of the sensor. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void downloadFileForResetPasswordOfTheSensor( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager + .onPremiseIotSensors() + .downloadResetPasswordWithResponse( + "mySensor", new ResetPasswordInput().withApplianceId("3214-528AV23-D121-D3-E1"), Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/OnPremiseIotSensorsGetSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/OnPremiseIotSensorsGetSamples.java new file mode 100644 index 000000000000..7552e6bf529c --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/OnPremiseIotSensorsGetSamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for OnPremiseIotSensors Get. */ +public final class OnPremiseIotSensorsGetSamples { + /** + * Sample code: Get on-premise IoT sensor. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void getOnPremiseIoTSensor(com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager.onPremiseIotSensors().getWithResponse("mySensor", Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/OnPremiseIotSensorsListSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/OnPremiseIotSensorsListSamples.java new file mode 100644 index 000000000000..327e18c41bdf --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/OnPremiseIotSensorsListSamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for OnPremiseIotSensors List. */ +public final class OnPremiseIotSensorsListSamples { + /** + * Sample code: List on-premise IoT sensors. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void listOnPremiseIoTSensors(com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager.onPremiseIotSensors().listWithResponse(Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/PricingsGetSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/PricingsGetSamples.java new file mode 100644 index 000000000000..fc2e9bb56a0a --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/PricingsGetSamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for Pricings Get. */ +public final class PricingsGetSamples { + /** + * Sample code: Get pricings on subscription. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void getPricingsOnSubscription(com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager.pricings().getWithResponse("VirtualMachines", Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/PricingsListSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/PricingsListSamples.java new file mode 100644 index 000000000000..703d0d9cd5ed --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/PricingsListSamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for Pricings List. */ +public final class PricingsListSamples { + /** + * Sample code: Get pricings on subscription. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void getPricingsOnSubscription(com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager.pricings().listWithResponse(Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/PricingsUpdateSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/PricingsUpdateSamples.java new file mode 100644 index 000000000000..9102510c307d --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/PricingsUpdateSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.PricingInner; +import com.azure.resourcemanager.security.models.PricingTier; + +/** Samples for Pricings Update. */ +public final class PricingsUpdateSamples { + /** + * Sample code: Update pricing on subscription. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void updatePricingOnSubscription(com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager + .pricings() + .updateWithResponse( + "VirtualMachines", new PricingInner().withPricingTier(PricingTier.STANDARD), Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/RegulatoryComplianceAssessmentsGetSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/RegulatoryComplianceAssessmentsGetSamples.java new file mode 100644 index 000000000000..af1bb81d6ace --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/RegulatoryComplianceAssessmentsGetSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for RegulatoryComplianceAssessments Get. */ +public final class RegulatoryComplianceAssessmentsGetSamples { + /** + * Sample code: Get selected regulatory compliance assessment details and state. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void getSelectedRegulatoryComplianceAssessmentDetailsAndState( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager + .regulatoryComplianceAssessments() + .getWithResponse("PCI-DSS-3.2", "1.1", "968548cb-02b3-8cd2-11f8-0cf64ab1a347", Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/RegulatoryComplianceAssessmentsListSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/RegulatoryComplianceAssessmentsListSamples.java new file mode 100644 index 000000000000..3099ee7d6f2d --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/RegulatoryComplianceAssessmentsListSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for RegulatoryComplianceAssessments List. */ +public final class RegulatoryComplianceAssessmentsListSamples { + /** + * Sample code: Get all assessments mapped to selected regulatory compliance control. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void getAllAssessmentsMappedToSelectedRegulatoryComplianceControl( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager.regulatoryComplianceAssessments().list("PCI-DSS-3.2", "1.1", null, Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/RegulatoryComplianceControlsGetSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/RegulatoryComplianceControlsGetSamples.java new file mode 100644 index 000000000000..ffac6ffea7a7 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/RegulatoryComplianceControlsGetSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for RegulatoryComplianceControls Get. */ +public final class RegulatoryComplianceControlsGetSamples { + /** + * Sample code: Get selected regulatory compliance control details and state. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void getSelectedRegulatoryComplianceControlDetailsAndState( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager.regulatoryComplianceControls().getWithResponse("PCI-DSS-3.2", "1.1", Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/RegulatoryComplianceControlsListSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/RegulatoryComplianceControlsListSamples.java new file mode 100644 index 000000000000..a3e8b3ffc374 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/RegulatoryComplianceControlsListSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for RegulatoryComplianceControls List. */ +public final class RegulatoryComplianceControlsListSamples { + /** + * Sample code: Get all regulatory compliance controls details and state for selected standard. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void getAllRegulatoryComplianceControlsDetailsAndStateForSelectedStandard( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager.regulatoryComplianceControls().list("PCI-DSS-3.2", null, Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/RegulatoryComplianceStandardsGetSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/RegulatoryComplianceStandardsGetSamples.java new file mode 100644 index 000000000000..7931c47fff84 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/RegulatoryComplianceStandardsGetSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for RegulatoryComplianceStandards Get. */ +public final class RegulatoryComplianceStandardsGetSamples { + /** + * Sample code: Get selected regulatory compliance standard details and state. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void getSelectedRegulatoryComplianceStandardDetailsAndState( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager.regulatoryComplianceStandards().getWithResponse("PCI-DSS-3.2", Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/RegulatoryComplianceStandardsListSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/RegulatoryComplianceStandardsListSamples.java new file mode 100644 index 000000000000..d9a460ad5280 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/RegulatoryComplianceStandardsListSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for RegulatoryComplianceStandards List. */ +public final class RegulatoryComplianceStandardsListSamples { + /** + * Sample code: Get all supported regulatory compliance standards details and state. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void getAllSupportedRegulatoryComplianceStandardsDetailsAndState( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager.regulatoryComplianceStandards().list(null, Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SecureScoreControlDefinitionsListBySubscriptionSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SecureScoreControlDefinitionsListBySubscriptionSamples.java new file mode 100644 index 000000000000..4929da4c92ed --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SecureScoreControlDefinitionsListBySubscriptionSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for SecureScoreControlDefinitions ListBySubscription. */ +public final class SecureScoreControlDefinitionsListBySubscriptionSamples { + /** + * Sample code: List security controls definition by subscription. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void listSecurityControlsDefinitionBySubscription( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager.secureScoreControlDefinitions().listBySubscription(Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SecureScoreControlDefinitionsListSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SecureScoreControlDefinitionsListSamples.java new file mode 100644 index 000000000000..5d5f79bad2d0 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SecureScoreControlDefinitionsListSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for SecureScoreControlDefinitions List. */ +public final class SecureScoreControlDefinitionsListSamples { + /** + * Sample code: List security controls definition. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void listSecurityControlsDefinition( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager.secureScoreControlDefinitions().list(Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SecureScoreControlsListBySecureScoreSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SecureScoreControlsListBySecureScoreSamples.java new file mode 100644 index 000000000000..92b5ede6edea --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SecureScoreControlsListBySecureScoreSamples.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.models.ExpandControlsEnum; + +/** Samples for SecureScoreControls ListBySecureScore. */ +public final class SecureScoreControlsListBySecureScoreSamples { + /** + * Sample code: Get security controls and their current score for the specified initiative with the expand + * parameter. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void getSecurityControlsAndTheirCurrentScoreForTheSpecifiedInitiativeWithTheExpandParameter( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager + .secureScoreControls() + .listBySecureScore("ascScore", ExpandControlsEnum.DEFINITION, Context.NONE); + } + + /** + * Sample code: Get security controls and their current score for the specified initiative. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void getSecurityControlsAndTheirCurrentScoreForTheSpecifiedInitiative( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager.secureScoreControls().listBySecureScore("ascScore", null, Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SecureScoreControlsListSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SecureScoreControlsListSamples.java new file mode 100644 index 000000000000..262f583cae53 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SecureScoreControlsListSamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for SecureScoreControls List. */ +public final class SecureScoreControlsListSamples { + /** + * Sample code: List all secure scores controls. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void listAllSecureScoresControls(com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager.secureScoreControls().list(null, Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SecureScoresGetSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SecureScoresGetSamples.java new file mode 100644 index 000000000000..ce64877674c8 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SecureScoresGetSamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for SecureScores Get. */ +public final class SecureScoresGetSamples { + /** + * Sample code: Get single secure score. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void getSingleSecureScore(com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager.secureScores().getWithResponse("ascScore", Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SecureScoresListSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SecureScoresListSamples.java new file mode 100644 index 000000000000..a8a2cbd57a9a --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SecureScoresListSamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for SecureScores List. */ +public final class SecureScoresListSamples { + /** + * Sample code: List secure scores. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void listSecureScores(com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager.secureScores().list(Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SecurityContactsCreateSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SecurityContactsCreateSamples.java new file mode 100644 index 000000000000..8122f57a22c7 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SecurityContactsCreateSamples.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.resourcemanager.security.models.AlertNotifications; +import com.azure.resourcemanager.security.models.AlertsToAdmins; + +/** Samples for SecurityContacts Create. */ +public final class SecurityContactsCreateSamples { + /** + * Sample code: Create security contact data minimal. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void createSecurityContactDataMinimal( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager + .securityContacts() + .define("default2") + .withEmail("chen@contoso.com") + .withAlertNotifications(AlertNotifications.ON) + .withAlertsToAdmins(AlertsToAdmins.ON) + .create(); + } + + /** + * Sample code: Create security contact data full. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void createSecurityContactDataFull( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager + .securityContacts() + .define("default1") + .withEmail("john@contoso.com") + .withPhone("(214)275-4038") + .withAlertNotifications(AlertNotifications.ON) + .withAlertsToAdmins(AlertsToAdmins.ON) + .create(); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SecurityContactsDeleteSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SecurityContactsDeleteSamples.java new file mode 100644 index 000000000000..5242484431a4 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SecurityContactsDeleteSamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for SecurityContacts Delete. */ +public final class SecurityContactsDeleteSamples { + /** + * Sample code: Delete security contact data. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void deleteSecurityContactData(com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager.securityContacts().deleteWithResponse("default1", Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SecurityContactsGetSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SecurityContactsGetSamples.java new file mode 100644 index 000000000000..9d98c0995eb7 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SecurityContactsGetSamples.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for SecurityContacts Get. */ +public final class SecurityContactsGetSamples { + /** + * Sample code: Get security contact data minimal. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void getSecurityContactDataMinimal( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager.securityContacts().getWithResponse("default2", Context.NONE); + } + + /** + * Sample code: Get security contact data full. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void getSecurityContactDataFull(com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager.securityContacts().getWithResponse("default1", Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SecurityContactsListSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SecurityContactsListSamples.java new file mode 100644 index 000000000000..85e587a4b698 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SecurityContactsListSamples.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for SecurityContacts List. */ +public final class SecurityContactsListSamples { + /** + * Sample code: Update security contact data minimal. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void updateSecurityContactDataMinimal( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager.securityContacts().list(Context.NONE); + } + + /** + * Sample code: Update security contact data full. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void updateSecurityContactDataFull( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager.securityContacts().list(Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SecurityContactsUpdateSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SecurityContactsUpdateSamples.java new file mode 100644 index 000000000000..b4835ab9df5e --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SecurityContactsUpdateSamples.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.models.AlertNotifications; +import com.azure.resourcemanager.security.models.SecurityContact; + +/** Samples for SecurityContacts Update. */ +public final class SecurityContactsUpdateSamples { + /** + * Sample code: Update security contact data minimal. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void updateSecurityContactDataMinimal( + com.azure.resourcemanager.security.SecurityManager securityManager) { + SecurityContact resource = + securityManager.securityContacts().getWithResponse("default2", Context.NONE).getValue(); + resource.update().withAlertNotifications(AlertNotifications.ON).apply(); + } + + /** + * Sample code: Update security contact data full. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void updateSecurityContactDataFull( + com.azure.resourcemanager.security.SecurityManager securityManager) { + SecurityContact resource = securityManager.securityContacts().getWithResponse("john", Context.NONE).getValue(); + resource.update().withPhone("(214)275-4038").withAlertNotifications(AlertNotifications.ON).apply(); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SecuritySolutionsGetSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SecuritySolutionsGetSamples.java new file mode 100644 index 000000000000..596a9e2a93ef --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SecuritySolutionsGetSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for SecuritySolutions Get. */ +public final class SecuritySolutionsGetSamples { + /** + * Sample code: Get a security solution from a security data location. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void getASecuritySolutionFromASecurityDataLocation( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager.securitySolutions().getWithResponse("myRg2", "centralus", "paloalto7", Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SecuritySolutionsListSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SecuritySolutionsListSamples.java new file mode 100644 index 000000000000..5de8ab0b45af --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SecuritySolutionsListSamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for SecuritySolutions List. */ +public final class SecuritySolutionsListSamples { + /** + * Sample code: Get security solutions. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void getSecuritySolutions(com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager.securitySolutions().list(Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SecuritySolutionsReferenceDataListByHomeRegionSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SecuritySolutionsReferenceDataListByHomeRegionSamples.java new file mode 100644 index 000000000000..571a17b95883 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SecuritySolutionsReferenceDataListByHomeRegionSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for SecuritySolutionsReferenceData ListByHomeRegion. */ +public final class SecuritySolutionsReferenceDataListByHomeRegionSamples { + /** + * Sample code: Get security solutions from a security data location. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void getSecuritySolutionsFromASecurityDataLocation( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager.securitySolutionsReferenceDatas().listByHomeRegionWithResponse("westcentralus", Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SecuritySolutionsReferenceDataListSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SecuritySolutionsReferenceDataListSamples.java new file mode 100644 index 000000000000..a4dee50417a6 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SecuritySolutionsReferenceDataListSamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for SecuritySolutionsReferenceData List. */ +public final class SecuritySolutionsReferenceDataListSamples { + /** + * Sample code: Get security solutions. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void getSecuritySolutions(com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager.securitySolutionsReferenceDatas().listWithResponse(Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/ServerVulnerabilityAssessmentCreateOrUpdateSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/ServerVulnerabilityAssessmentCreateOrUpdateSamples.java new file mode 100644 index 000000000000..b16ff165ae2a --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/ServerVulnerabilityAssessmentCreateOrUpdateSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for ServerVulnerabilityAssessment CreateOrUpdate. */ +public final class ServerVulnerabilityAssessmentCreateOrUpdateSamples { + /** + * Sample code: Create a server vulnerability assessments on a resource. Only 'default' resource is supported. Once + * creating the resource, the server will be onboarded to vulnerability assessment by Microsoft.Security. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void + createAServerVulnerabilityAssessmentsOnAResourceOnlyDefaultResourceIsSupportedOnceCreatingTheResourceTheServerWillBeOnboardedToVulnerabilityAssessmentByMicrosoftSecurity( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager + .serverVulnerabilityAssessments() + .createOrUpdateWithResponse("rg1", "Microsoft.Compute", "virtualMachines", "vm1", Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/ServerVulnerabilityAssessmentDeleteSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/ServerVulnerabilityAssessmentDeleteSamples.java new file mode 100644 index 000000000000..a76d502b5ed6 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/ServerVulnerabilityAssessmentDeleteSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for ServerVulnerabilityAssessment Delete. */ +public final class ServerVulnerabilityAssessmentDeleteSamples { + /** + * Sample code: Delete a server vulnerability assessments on a resource. Only 'default' resource is supported. Once + * deleting, Microsoft.Security will not provide vulnerability assessment findings on the resource. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void + deleteAServerVulnerabilityAssessmentsOnAResourceOnlyDefaultResourceIsSupportedOnceDeletingMicrosoftSecurityWillNotProvideVulnerabilityAssessmentFindingsOnTheResource( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager + .serverVulnerabilityAssessments() + .delete("rg1", "Microsoft.Compute", "virtualMachines", "vm1", Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/ServerVulnerabilityAssessmentGetSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/ServerVulnerabilityAssessmentGetSamples.java new file mode 100644 index 000000000000..7e6e17855d72 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/ServerVulnerabilityAssessmentGetSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for ServerVulnerabilityAssessment Get. */ +public final class ServerVulnerabilityAssessmentGetSamples { + /** + * Sample code: Get a server vulnerability assessments onboarding status on a resource. Currently Microsoft.Security + * only supports the single 'default' resource. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void + getAServerVulnerabilityAssessmentsOnboardingStatusOnAResourceCurrentlyMicrosoftSecurityOnlySupportsTheSingleDefaultResource( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager + .serverVulnerabilityAssessments() + .getWithResponse("rg1", "Microsoft.Compute", "virtualMachines", "vm1", Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/ServerVulnerabilityAssessmentListByExtendedResourceSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/ServerVulnerabilityAssessmentListByExtendedResourceSamples.java new file mode 100644 index 000000000000..202571e39bef --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/ServerVulnerabilityAssessmentListByExtendedResourceSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for ServerVulnerabilityAssessment ListByExtendedResource. */ +public final class ServerVulnerabilityAssessmentListByExtendedResourceSamples { + /** + * Sample code: Get a list of server vulnerability assessments on a resource. Though this API returns a list, + * Currently Microsoft.Security only supports a single default type of server vulnerability assessment. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void + getAListOfServerVulnerabilityAssessmentsOnAResourceThoughThisAPIReturnsAListCurrentlyMicrosoftSecurityOnlySupportsASingleDefaultTypeOfServerVulnerabilityAssessment( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager + .serverVulnerabilityAssessments() + .listByExtendedResourceWithResponse("rg1", "Microsoft.Compute", "virtualMachines", "vm1", Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SettingsGetSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SettingsGetSamples.java new file mode 100644 index 000000000000..4d6cec7b9c8f --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SettingsGetSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.models.SettingsSettingName; + +/** Samples for Settings Get. */ +public final class SettingsGetSamples { + /** + * Sample code: Get a setting on subscription. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void getASettingOnSubscription(com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager.settings().getWithResponse(SettingsSettingName.MCAS, Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SettingsListSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SettingsListSamples.java new file mode 100644 index 000000000000..b2ee58f03c97 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SettingsListSamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for Settings List. */ +public final class SettingsListSamples { + /** + * Sample code: Get settings of subscription. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void getSettingsOfSubscription(com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager.settings().list(Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SettingsUpdateSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SettingsUpdateSamples.java new file mode 100644 index 000000000000..d637c330428b --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SettingsUpdateSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.models.DataExportSettings; +import com.azure.resourcemanager.security.models.SettingsSettingName; + +/** Samples for Settings Update. */ +public final class SettingsUpdateSamples { + /** + * Sample code: Update a setting for subscription. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void updateASettingForSubscription( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager + .settings() + .updateWithResponse(SettingsSettingName.MCAS, new DataExportSettings().withEnabled(true), Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SoftwareInventoriesGetSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SoftwareInventoriesGetSamples.java new file mode 100644 index 000000000000..5fa329832916 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SoftwareInventoriesGetSamples.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for SoftwareInventories Get. */ +public final class SoftwareInventoriesGetSamples { + /** + * Sample code: Gets a single software data of the virtual machine. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void getsASingleSoftwareDataOfTheVirtualMachine( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager + .softwareInventories() + .getWithResponse( + "EITAN-TESTS", + "Microsoft.Compute", + "virtualMachines", + "Eitan-Test1", + "outlook_16.0.10371.20060", + Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SoftwareInventoriesListByExtendedResourceSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SoftwareInventoriesListByExtendedResourceSamples.java new file mode 100644 index 000000000000..64db12e3120d --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SoftwareInventoriesListByExtendedResourceSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for SoftwareInventories ListByExtendedResource. */ +public final class SoftwareInventoriesListByExtendedResourceSamples { + /** + * Sample code: Gets the software inventory of the virtual machine. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void getsTheSoftwareInventoryOfTheVirtualMachine( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager + .softwareInventories() + .listByExtendedResource("EITAN-TESTS", "Microsoft.Compute", "virtualMachines", "Eitan-Test1", Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SoftwareInventoriesListSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SoftwareInventoriesListSamples.java new file mode 100644 index 000000000000..5f65508eeca0 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SoftwareInventoriesListSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for SoftwareInventories List. */ +public final class SoftwareInventoriesListSamples { + /** + * Sample code: Gets the software inventory of all virtual machines in the subscriptions. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void getsTheSoftwareInventoryOfAllVirtualMachinesInTheSubscriptions( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager.softwareInventories().list(Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SqlVulnerabilityAssessmentBaselineRulesAddSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SqlVulnerabilityAssessmentBaselineRulesAddSamples.java new file mode 100644 index 000000000000..cd69b7e6cb06 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SqlVulnerabilityAssessmentBaselineRulesAddSamples.java @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.models.RulesResultsInput; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for SqlVulnerabilityAssessmentBaselineRules Add. */ +public final class SqlVulnerabilityAssessmentBaselineRulesAddSamples { + /** + * Sample code: Create a baseline for all rules. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void createABaselineForAllRules(com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager + .sqlVulnerabilityAssessmentBaselineRules() + .addWithResponse( + "55555555-6666-7777-8888-999999999999", + "subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.HybridCompute/machines/MyMachine/sqlServers/server1/databases/master", + new RulesResultsInput() + .withLatestScan(false) + .withResults( + mapOf( + "VA1234", + Arrays.asList(Arrays.asList("userA", "SELECT"), Arrays.asList("userB", "SELECT")), + "VA5678", + Arrays.asList(Arrays.asList("Test", "0.0.0.0", "125.125.125.125")))), + Context.NONE); + } + + /** + * Sample code: Create a baseline for all rules using the latest scan results. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void createABaselineForAllRulesUsingTheLatestScanResults( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager + .sqlVulnerabilityAssessmentBaselineRules() + .addWithResponse( + "55555555-6666-7777-8888-999999999999", + "subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.HybridCompute/machines/MyMachine/sqlServers/server1/databases/master", + new RulesResultsInput().withLatestScan(true).withResults(mapOf()), + Context.NONE); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SqlVulnerabilityAssessmentBaselineRulesCreateOrUpdateSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SqlVulnerabilityAssessmentBaselineRulesCreateOrUpdateSamples.java new file mode 100644 index 000000000000..d941f2e4dd0e --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SqlVulnerabilityAssessmentBaselineRulesCreateOrUpdateSamples.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import java.util.Arrays; + +/** Samples for SqlVulnerabilityAssessmentBaselineRules CreateOrUpdate. */ +public final class SqlVulnerabilityAssessmentBaselineRulesCreateOrUpdateSamples { + /** + * Sample code: Create a baseline using the latest scan results. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void createABaselineUsingTheLatestScanResults( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager + .sqlVulnerabilityAssessmentBaselineRules() + .define("VA1234") + .withExistingResourceId( + "subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.HybridCompute/machines/MyMachine/sqlServers/server1/databases/master") + .withLatestScan(true) + .withResults(Arrays.asList()) + .withWorkspaceId("55555555-6666-7777-8888-999999999999") + .create(); + } + + /** + * Sample code: Create a baseline. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void createABaseline(com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager + .sqlVulnerabilityAssessmentBaselineRules() + .define("VA1234") + .withExistingResourceId( + "subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.HybridCompute/machines/MyMachine/sqlServers/server1/databases/master") + .withLatestScan(false) + .withResults(Arrays.asList(Arrays.asList("userA", "SELECT"), Arrays.asList("userB", "SELECT"))) + .withWorkspaceId("55555555-6666-7777-8888-999999999999") + .create(); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SqlVulnerabilityAssessmentBaselineRulesDeleteSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SqlVulnerabilityAssessmentBaselineRulesDeleteSamples.java new file mode 100644 index 000000000000..ec5faa465280 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SqlVulnerabilityAssessmentBaselineRulesDeleteSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for SqlVulnerabilityAssessmentBaselineRules Delete. */ +public final class SqlVulnerabilityAssessmentBaselineRulesDeleteSamples { + /** + * Sample code: Delete the baseline. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void deleteTheBaseline(com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager + .sqlVulnerabilityAssessmentBaselineRules() + .deleteWithResponse( + "VA1234", + "55555555-6666-7777-8888-999999999999", + "subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.HybridCompute/machines/MyMachine/sqlServers/server1/databases/master", + Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SqlVulnerabilityAssessmentBaselineRulesGetSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SqlVulnerabilityAssessmentBaselineRulesGetSamples.java new file mode 100644 index 000000000000..a4fff784603f --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SqlVulnerabilityAssessmentBaselineRulesGetSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for SqlVulnerabilityAssessmentBaselineRules Get. */ +public final class SqlVulnerabilityAssessmentBaselineRulesGetSamples { + /** + * Sample code: Get the baseline. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void getTheBaseline(com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager + .sqlVulnerabilityAssessmentBaselineRules() + .getWithResponse( + "VA1234", + "55555555-6666-7777-8888-999999999999", + "subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.HybridCompute/machines/MyMachine/sqlServers/server1/databases/master", + Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SqlVulnerabilityAssessmentBaselineRulesListSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SqlVulnerabilityAssessmentBaselineRulesListSamples.java new file mode 100644 index 000000000000..ad21bbf21e93 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SqlVulnerabilityAssessmentBaselineRulesListSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for SqlVulnerabilityAssessmentBaselineRules List. */ +public final class SqlVulnerabilityAssessmentBaselineRulesListSamples { + /** + * Sample code: List baseline for all rules. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void listBaselineForAllRules(com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager + .sqlVulnerabilityAssessmentBaselineRules() + .listWithResponse( + "55555555-6666-7777-8888-999999999999", + "subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.HybridCompute/machines/MyMachine/sqlServers/server1/databases/master", + Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SqlVulnerabilityAssessmentScanResultsGetSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SqlVulnerabilityAssessmentScanResultsGetSamples.java new file mode 100644 index 000000000000..33b6c2a56644 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SqlVulnerabilityAssessmentScanResultsGetSamples.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for SqlVulnerabilityAssessmentScanResults Get. */ +public final class SqlVulnerabilityAssessmentScanResultsGetSamples { + /** + * Sample code: Get scan details of a scan record. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void getScanDetailsOfAScanRecord(com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager + .sqlVulnerabilityAssessmentScanResults() + .getWithResponse( + "Scheduled-20200623", + "VA2063", + "55555555-6666-7777-8888-999999999999", + "subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.HybridCompute/machines/MyMachine/sqlServers/server1/databases/master", + Context.NONE); + } + + /** + * Sample code: Get scan details of the latest scan record. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void getScanDetailsOfTheLatestScanRecord( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager + .sqlVulnerabilityAssessmentScanResults() + .getWithResponse( + "latest", + "VA2063", + "55555555-6666-7777-8888-999999999999", + "subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.HybridCompute/machines/MyMachine/sqlServers/server1/databases/master", + Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SqlVulnerabilityAssessmentScanResultsListSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SqlVulnerabilityAssessmentScanResultsListSamples.java new file mode 100644 index 000000000000..ede5d3ca69bf --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SqlVulnerabilityAssessmentScanResultsListSamples.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for SqlVulnerabilityAssessmentScanResults List. */ +public final class SqlVulnerabilityAssessmentScanResultsListSamples { + /** + * Sample code: List scan results of the latest scan. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void listScanResultsOfTheLatestScan( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager + .sqlVulnerabilityAssessmentScanResults() + .listWithResponse( + "latest", + "55555555-6666-7777-8888-999999999999", + "subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.HybridCompute/machines/MyMachine/sqlServers/server1/databases/master", + Context.NONE); + } + + /** + * Sample code: List scan results. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void listScanResults(com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager + .sqlVulnerabilityAssessmentScanResults() + .listWithResponse( + "Scheduled-20200623", + "55555555-6666-7777-8888-999999999999", + "subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.HybridCompute/machines/MyMachine/sqlServers/server1/databases/master", + Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SqlVulnerabilityAssessmentScansGetSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SqlVulnerabilityAssessmentScansGetSamples.java new file mode 100644 index 000000000000..5df8d2e1d252 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SqlVulnerabilityAssessmentScansGetSamples.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for SqlVulnerabilityAssessmentScans Get. */ +public final class SqlVulnerabilityAssessmentScansGetSamples { + /** + * Sample code: Get scan details of a scan record. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void getScanDetailsOfAScanRecord(com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager + .sqlVulnerabilityAssessmentScans() + .getWithResponse( + "Scheduled-20200623", + "55555555-6666-7777-8888-999999999999", + "subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.HybridCompute/machines/MyMachine/sqlServers/server1/databases/master", + Context.NONE); + } + + /** + * Sample code: Get scan details of the latest scan record. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void getScanDetailsOfTheLatestScanRecord( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager + .sqlVulnerabilityAssessmentScans() + .getWithResponse( + "latest", + "55555555-6666-7777-8888-999999999999", + "subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.HybridCompute/machines/MyMachine/sqlServers/server1/databases/master", + Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SqlVulnerabilityAssessmentScansListSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SqlVulnerabilityAssessmentScansListSamples.java new file mode 100644 index 000000000000..35629aea0442 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SqlVulnerabilityAssessmentScansListSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for SqlVulnerabilityAssessmentScans List. */ +public final class SqlVulnerabilityAssessmentScansListSamples { + /** + * Sample code: List scan details. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void listScanDetails(com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager + .sqlVulnerabilityAssessmentScans() + .listWithResponse( + "55555555-6666-7777-8888-999999999999", + "subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.HybridCompute/machines/MyMachine/sqlServers/server1/databases/master", + Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SubAssessmentsGetSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SubAssessmentsGetSamples.java new file mode 100644 index 000000000000..f714507b11e1 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SubAssessmentsGetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for SubAssessments Get. */ +public final class SubAssessmentsGetSamples { + /** + * Sample code: Get security recommendation task from security data location. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void getSecurityRecommendationTaskFromSecurityDataLocation( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager + .subAssessments() + .getWithResponse( + "subscriptions/212f9889-769e-45ae-ab43-6da33674bd26/resourceGroups/DEMORG/providers/Microsoft.Compute/virtualMachines/vm2", + "1195afff-c881-495e-9bc5-1486211ae03f", + "95f7da9c-a2a4-1322-0758-fcd24ef09b85", + Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SubAssessmentsListAllSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SubAssessmentsListAllSamples.java new file mode 100644 index 000000000000..5ba4c8288269 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SubAssessmentsListAllSamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for SubAssessments ListAll. */ +public final class SubAssessmentsListAllSamples { + /** + * Sample code: List security sub-assessments. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void listSecuritySubAssessments(com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager.subAssessments().listAll("subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23", Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SubAssessmentsListSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SubAssessmentsListSamples.java new file mode 100644 index 000000000000..a69467e5ef4f --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/SubAssessmentsListSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for SubAssessments List. */ +public final class SubAssessmentsListSamples { + /** + * Sample code: List security sub-assessments. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void listSecuritySubAssessments(com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager + .subAssessments() + .list( + "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23", + "82e20e14-edc5-4373-bfc4-f13121257c37", + Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/TasksGetResourceGroupLevelTaskSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/TasksGetResourceGroupLevelTaskSamples.java new file mode 100644 index 000000000000..4928c649965c --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/TasksGetResourceGroupLevelTaskSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for Tasks GetResourceGroupLevelTask. */ +public final class TasksGetResourceGroupLevelTaskSamples { + /** + * Sample code: Get security recommendation task in a resource group. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void getSecurityRecommendationTaskInAResourceGroup( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager + .tasks() + .getResourceGroupLevelTaskWithResponse( + "myRg", "westeurope", "d55b4dc0-779c-c66c-33e5-d7bce24c4222", Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/TasksGetSubscriptionLevelTaskSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/TasksGetSubscriptionLevelTaskSamples.java new file mode 100644 index 000000000000..3bc50fc31eb8 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/TasksGetSubscriptionLevelTaskSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for Tasks GetSubscriptionLevelTask. */ +public final class TasksGetSubscriptionLevelTaskSamples { + /** + * Sample code: Get security recommendation task from security data location. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void getSecurityRecommendationTaskFromSecurityDataLocation( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager + .tasks() + .getSubscriptionLevelTaskWithResponse("westeurope", "62609ee7-d0a5-8616-9fe4-1df5cca7758d", Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/TasksListByHomeRegionSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/TasksListByHomeRegionSamples.java new file mode 100644 index 000000000000..6b4fe6c36456 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/TasksListByHomeRegionSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for Tasks ListByHomeRegion. */ +public final class TasksListByHomeRegionSamples { + /** + * Sample code: Get security recommendations tasks from security data location. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void getSecurityRecommendationsTasksFromSecurityDataLocation( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager.tasks().listByHomeRegion("westeurope", null, Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/TasksListByResourceGroupSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/TasksListByResourceGroupSamples.java new file mode 100644 index 000000000000..7aee116bcf29 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/TasksListByResourceGroupSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for Tasks ListByResourceGroup. */ +public final class TasksListByResourceGroupSamples { + /** + * Sample code: Get security recommendation tasks in a resource group. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void getSecurityRecommendationTasksInAResourceGroup( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager.tasks().listByResourceGroup("myRg", "westeurope", null, Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/TasksListSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/TasksListSamples.java new file mode 100644 index 000000000000..0738f549721a --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/TasksListSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for Tasks List. */ +public final class TasksListSamples { + /** + * Sample code: Get security recommendations tasks. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void getSecurityRecommendationsTasks( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager.tasks().list(null, Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/TasksUpdateResourceGroupLevelTaskStateSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/TasksUpdateResourceGroupLevelTaskStateSamples.java new file mode 100644 index 000000000000..07300cb1ca0c --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/TasksUpdateResourceGroupLevelTaskStateSamples.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.models.TasksTaskUpdateActionType; + +/** Samples for Tasks UpdateResourceGroupLevelTaskState. */ +public final class TasksUpdateResourceGroupLevelTaskStateSamples { + /** + * Sample code: Change security recommendation task state. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void changeSecurityRecommendationTaskState( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager + .tasks() + .updateResourceGroupLevelTaskStateWithResponse( + "myRg", + "westeurope", + "d55b4dc0-779c-c66c-33e5-d7bce24c4222", + TasksTaskUpdateActionType.DISMISS, + Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/TasksUpdateSubscriptionLevelTaskStateSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/TasksUpdateSubscriptionLevelTaskStateSamples.java new file mode 100644 index 000000000000..6b2bcdbaf26b --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/TasksUpdateSubscriptionLevelTaskStateSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.models.TasksTaskUpdateActionType; + +/** Samples for Tasks UpdateSubscriptionLevelTaskState. */ +public final class TasksUpdateSubscriptionLevelTaskStateSamples { + /** + * Sample code: Change security recommendation task state. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void changeSecurityRecommendationTaskState( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager + .tasks() + .updateSubscriptionLevelTaskStateWithResponse( + "westeurope", "62609ee7-d0a5-8616-9fe4-1df5cca7758d", TasksTaskUpdateActionType.DISMISS, Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/TopologyGetSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/TopologyGetSamples.java new file mode 100644 index 000000000000..1df814b85263 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/TopologyGetSamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for Topology Get. */ +public final class TopologyGetSamples { + /** + * Sample code: Get topology. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void getTopology(com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager.topologies().getWithResponse("myservers", "centralus", "vnets", Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/TopologyListByHomeRegionSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/TopologyListByHomeRegionSamples.java new file mode 100644 index 000000000000..f0e2b21c8786 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/TopologyListByHomeRegionSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for Topology ListByHomeRegion. */ +public final class TopologyListByHomeRegionSamples { + /** + * Sample code: Get topology on a subscription from security data location. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void getTopologyOnASubscriptionFromSecurityDataLocation( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager.topologies().listByHomeRegion("centralus", Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/TopologyListSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/TopologyListSamples.java new file mode 100644 index 000000000000..a9ee3b001676 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/TopologyListSamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for Topology List. */ +public final class TopologyListSamples { + /** + * Sample code: Get topology on a subscription. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void getTopologyOnASubscription(com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager.topologies().list(Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/WorkspaceSettingsCreateSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/WorkspaceSettingsCreateSamples.java new file mode 100644 index 000000000000..d115370a96eb --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/WorkspaceSettingsCreateSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +/** Samples for WorkspaceSettings Create. */ +public final class WorkspaceSettingsCreateSamples { + /** + * Sample code: Create a workspace setting data for subscription. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void createAWorkspaceSettingDataForSubscription( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager + .workspaceSettings() + .define("default") + .withWorkspaceId( + "/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace") + .withScope("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23") + .create(); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/WorkspaceSettingsDeleteSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/WorkspaceSettingsDeleteSamples.java new file mode 100644 index 000000000000..e3c3c33d96ae --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/WorkspaceSettingsDeleteSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for WorkspaceSettings Delete. */ +public final class WorkspaceSettingsDeleteSamples { + /** + * Sample code: Delete a workspace setting data for resource group. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void deleteAWorkspaceSettingDataForResourceGroup( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager.workspaceSettings().deleteWithResponse("default", Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/WorkspaceSettingsGetSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/WorkspaceSettingsGetSamples.java new file mode 100644 index 000000000000..45f39f7d9df6 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/WorkspaceSettingsGetSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for WorkspaceSettings Get. */ +public final class WorkspaceSettingsGetSamples { + /** + * Sample code: Get a workspace setting on subscription. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void getAWorkspaceSettingOnSubscription( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager.workspaceSettings().getWithResponse("default", Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/WorkspaceSettingsListSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/WorkspaceSettingsListSamples.java new file mode 100644 index 000000000000..50f641d10f02 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/WorkspaceSettingsListSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; + +/** Samples for WorkspaceSettings List. */ +public final class WorkspaceSettingsListSamples { + /** + * Sample code: Get workspace settings on subscription. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void getWorkspaceSettingsOnSubscription( + com.azure.resourcemanager.security.SecurityManager securityManager) { + securityManager.workspaceSettings().list(Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/WorkspaceSettingsUpdateSamples.java b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/WorkspaceSettingsUpdateSamples.java new file mode 100644 index 000000000000..6aa8064d0b98 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/WorkspaceSettingsUpdateSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.models.WorkspaceSetting; + +/** Samples for WorkspaceSettings Update. */ +public final class WorkspaceSettingsUpdateSamples { + /** + * Sample code: Update a workspace setting data for subscription. + * + * @param securityManager Entry point to SecurityManager. API spec for Microsoft.Security (Azure Security Center) + * resource provider. + */ + public static void updateAWorkspaceSettingDataForSubscription( + com.azure.resourcemanager.security.SecurityManager securityManager) { + WorkspaceSetting resource = + securityManager.workspaceSettings().getWithResponse("default", Context.NONE).getValue(); + resource + .update() + .withWorkspaceId( + "/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace") + .apply(); + } +} diff --git a/sdk/security/ci.yml b/sdk/security/ci.yml new file mode 100644 index 000000000000..f62ca7a1041b --- /dev/null +++ b/sdk/security/ci.yml @@ -0,0 +1,33 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - master + - main + - hotfix/* + - release/* + paths: + include: + - sdk/security/ + +pr: + branches: + include: + - master + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/security/ + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: security + Artifacts: + - name: azure-resourcemanager-security + groupId: com.azure.resourcemanager + safeName: azureresourcemanagersecurity diff --git a/sdk/security/pom.xml b/sdk/security/pom.xml new file mode 100644 index 000000000000..75a0c4ebe274 --- /dev/null +++ b/sdk/security/pom.xml @@ -0,0 +1,53 @@ + + + 4.0.0 + com.azure + azure-security-service + pom + 1.0.0 + + + + coverage + + + + + + + + + + org.jacoco + jacoco-maven-plugin + 0.8.5 + + + report-aggregate + verify + + report-aggregate + + + ${project.reporting.outputDirectory}/test-coverage + + + + + + + + + default + + true + + + azure-resourcemanager-security + + + +