Skip to content

Commit

Permalink
CodeGen from PR 31029 in Azure/azure-rest-api-specs
Browse files Browse the repository at this point in the history
Merge e79ae6e0d36ccca9e9ded83e308f4ec367708986 into 0035f4bd79ef31f8d4e3303ed0a38c1087f57fcf
  • Loading branch information
SDKAuto committed Nov 4, 2024
1 parent fc80c58 commit 660fd52
Show file tree
Hide file tree
Showing 797 changed files with 32,916 additions and 21,345 deletions.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Azure Resource Manager RecoveryServicesBackup client library for Java.

This package contains Microsoft Azure SDK for RecoveryServicesBackup Management SDK. Open API 2.0 Specs for Azure RecoveryServices Backup service. Package tag package-2024-04. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt).
This package contains Microsoft Azure SDK for RecoveryServicesBackup Management SDK. Open API 2.0 Specs for Azure RecoveryServices Backup service. Package tag package-preview-2024-11-01. 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

Expand Down Expand Up @@ -32,7 +32,7 @@ Various documentation is available to help you get started
<dependency>
<groupId>com.azure.resourcemanager</groupId>
<artifactId>azure-resourcemanager-recoveryservicesbackup</artifactId>
<version>1.4.0</version>
<version>1.5.0-beta.1</version>
</dependency>
```
[//]: # ({x-version-update-end})
Expand All @@ -45,15 +45,11 @@ Azure Management Libraries require a `TokenCredential` implementation for authen

### Authentication

By default, Microsoft Entra ID token authentication depends on correct configuration of the following environment variables.
Microsoft Entra ID token authentication relies on the [credential class][azure_identity_credentials] from [Azure Identity][azure_identity] package.

- `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.
Azure subscription ID can be configured via `AZURE_SUBSCRIPTION_ID` environment variable.

In addition, Azure subscription ID can be configured via `AZURE_SUBSCRIPTION_ID` environment variable.

With above configuration, `azure` client can be authenticated using the following code:
Assuming the use of the `DefaultAzureCredential` credential class, the client can be authenticated using the following code:

```java
AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE);
Expand All @@ -75,100 +71,77 @@ See [API design][design] for general introduction on design and key concepts on
## Examples

```java
OffsetDateTime scheduleDateTime = OffsetDateTime.parse(
OffsetDateTime.now(Clock.systemUTC())
.withNano(0).withMinute(0).withSecond(0)
.plusDays(1).format(DateTimeFormatter.ISO_INSTANT));

List<SubProtectionPolicy> lstSubProtectionPolicy = Arrays.asList(
new SubProtectionPolicy()
.withPolicyType(PolicyType.FULL)
.withSchedulePolicy(
new SimpleSchedulePolicy()
.withScheduleRunFrequency(ScheduleRunType.WEEKLY)
.withScheduleRunDays(Arrays.asList(DayOfWeek.SUNDAY, DayOfWeek.TUESDAY))
.withScheduleRunTimes(Arrays.asList(scheduleDateTime)))
.withRetentionPolicy(
new LongTermRetentionPolicy()
.withWeeklySchedule(
new WeeklyRetentionSchedule()
.withDaysOfTheWeek(Arrays.asList(DayOfWeek.SUNDAY, DayOfWeek.TUESDAY))
.withRetentionTimes(Arrays.asList(scheduleDateTime))
.withRetentionDuration(
new RetentionDuration()
.withCount(2)
OffsetDateTime scheduleDateTime = OffsetDateTime.parse(OffsetDateTime.now(Clock.systemUTC())
.withNano(0)
.withMinute(0)
.withSecond(0)
.plusDays(1)
.format(DateTimeFormatter.ISO_INSTANT));

List<SubProtectionPolicy> lstSubProtectionPolicy
= Arrays
.asList(
new SubProtectionPolicy().withPolicyType(PolicyType.FULL)
.withSchedulePolicy(
new SimpleSchedulePolicy().withScheduleRunFrequency(ScheduleRunType.WEEKLY)
.withScheduleRunDays(Arrays.asList(DayOfWeek.SUNDAY, DayOfWeek.TUESDAY))
.withScheduleRunTimes(Arrays.asList(scheduleDateTime)))
.withRetentionPolicy(
new LongTermRetentionPolicy()
.withWeeklySchedule(new WeeklyRetentionSchedule()
.withDaysOfTheWeek(Arrays.asList(DayOfWeek.SUNDAY, DayOfWeek.TUESDAY))
.withRetentionTimes(Arrays.asList(scheduleDateTime))
.withRetentionDuration(new RetentionDuration().withCount(2)
.withDurationType(RetentionDurationType.WEEKS)))
.withMonthlySchedule(
new MonthlyRetentionSchedule()
.withRetentionScheduleFormatType(RetentionScheduleFormat.WEEKLY)
.withRetentionScheduleWeekly(
new WeeklyRetentionFormat()
.withMonthlySchedule(new MonthlyRetentionSchedule()
.withRetentionScheduleFormatType(RetentionScheduleFormat.WEEKLY)
.withRetentionScheduleWeekly(new WeeklyRetentionFormat()
.withDaysOfTheWeek(Arrays.asList(DayOfWeek.SUNDAY))
.withWeeksOfTheMonth(Arrays.asList(WeekOfMonth.SECOND)))
.withRetentionTimes(Arrays.asList(scheduleDateTime))
.withRetentionDuration(
new RetentionDuration()
.withRetentionTimes(Arrays.asList(scheduleDateTime))
.withRetentionDuration(new RetentionDuration()
.withCount(1)
.withDurationType(RetentionDurationType.MONTHS)))
.withYearlySchedule(
new YearlyRetentionSchedule()
.withRetentionScheduleFormatType(RetentionScheduleFormat.WEEKLY)
.withMonthsOfYear(Arrays.asList(MonthOfYear.JANUARY, MonthOfYear.JUNE, MonthOfYear.DECEMBER))
.withRetentionScheduleWeekly(
new WeeklyRetentionFormat()
.withYearlySchedule(new YearlyRetentionSchedule()
.withRetentionScheduleFormatType(RetentionScheduleFormat.WEEKLY)
.withMonthsOfYear(
Arrays.asList(MonthOfYear.JANUARY, MonthOfYear.JUNE, MonthOfYear.DECEMBER))
.withRetentionScheduleWeekly(new WeeklyRetentionFormat()
.withDaysOfTheWeek(Arrays.asList(DayOfWeek.SUNDAY))
.withWeeksOfTheMonth(Arrays.asList(WeekOfMonth.LAST)))
.withRetentionTimes(Arrays.asList(scheduleDateTime))
.withRetentionDuration(
new RetentionDuration()
.withCount(1)
.withRetentionTimes(Arrays.asList(scheduleDateTime))
.withRetentionDuration(new RetentionDuration().withCount(1)
.withDurationType(RetentionDurationType.YEARS)))),
new SubProtectionPolicy()
.withPolicyType(PolicyType.DIFFERENTIAL)
.withSchedulePolicy(
new SimpleSchedulePolicy()
.withScheduleRunFrequency(ScheduleRunType.WEEKLY)
.withScheduleRunDays(Arrays.asList(DayOfWeek.FRIDAY))
.withScheduleRunTimes(Arrays.asList(scheduleDateTime)))
.withRetentionPolicy(
new SimpleRetentionPolicy()
.withRetentionDuration(
new RetentionDuration()
.withCount(8)
.withDurationType(RetentionDurationType.DAYS))),
new SubProtectionPolicy()
.withPolicyType(PolicyType.LOG)
.withSchedulePolicy(new LogSchedulePolicy().withScheduleFrequencyInMins(60))
.withRetentionPolicy(
new SimpleRetentionPolicy()
.withRetentionDuration(
new RetentionDuration()
.withCount(7)
.withDurationType(RetentionDurationType.DAYS))));
new SubProtectionPolicy().withPolicyType(PolicyType.DIFFERENTIAL)
.withSchedulePolicy(
new SimpleSchedulePolicy().withScheduleRunFrequency(ScheduleRunType.WEEKLY)
.withScheduleRunDays(Arrays.asList(DayOfWeek.FRIDAY))
.withScheduleRunTimes(Arrays.asList(scheduleDateTime)))
.withRetentionPolicy(new SimpleRetentionPolicy().withRetentionDuration(
new RetentionDuration().withCount(8).withDurationType(RetentionDurationType.DAYS))),
new SubProtectionPolicy().withPolicyType(PolicyType.LOG)
.withSchedulePolicy(new LogSchedulePolicy().withScheduleFrequencyInMins(60))
.withRetentionPolicy(new SimpleRetentionPolicy().withRetentionDuration(
new RetentionDuration().withCount(7).withDurationType(RetentionDurationType.DAYS))));

vault = recoveryServicesManager.vaults()
.define(vaultName)
.withRegion(REGION)
.withExistingResourceGroup(resourceGroupName)
.withSku(new Sku().withName(SkuName.RS0).withTier("Standard"))
.withProperties(new VaultProperties()
.withPublicNetworkAccess(PublicNetworkAccess.ENABLED)
.withProperties(new VaultProperties().withPublicNetworkAccess(PublicNetworkAccess.ENABLED)
.withRestoreSettings(new RestoreSettings()
.withCrossSubscriptionRestoreSettings(
new CrossSubscriptionRestoreSettings()
.withCrossSubscriptionRestoreState(CrossSubscriptionRestoreState.ENABLED))))
.withCrossSubscriptionRestoreSettings(new CrossSubscriptionRestoreSettings()
.withCrossSubscriptionRestoreState(CrossSubscriptionRestoreState.ENABLED))))
.create();

protectionPolicyResource = recoveryServicesBackupManager.protectionPolicies()
.define(policyName)
.withRegion(REGION)
.withExistingVault(vaultName, resourceGroupName)
.withProperties(
new AzureVmWorkloadProtectionPolicy()
.withWorkLoadType(WorkloadType.SQLDATA_BASE)
.withSettings(new Settings().withTimeZone("Pacific Standard Time").withIssqlcompression(false))
.withSubProtectionPolicy(lstSubProtectionPolicy)
)
.withProperties(new AzureVmWorkloadProtectionPolicy().withWorkLoadType(WorkloadType.SQLDATA_BASE)
.withSettings(new Settings().withTimeZone("Pacific Standard Time").withIssqlcompression(false))
.withSubProtectionPolicy(lstSubProtectionPolicy))
.create();
```
[Code snippets and samples](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/SAMPLE.md)
Expand All @@ -194,6 +167,7 @@ This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For m
[jdk]: https://learn.microsoft.com/azure/developer/java/fundamentals/
[azure_subscription]: https://azure.microsoft.com/free/
[azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/identity/azure-identity
[azure_identity_credentials]: https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/identity/azure-identity#credentials
[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
Expand Down
Loading

0 comments on commit 660fd52

Please sign in to comment.