Java 用 Azure Resource Manager RecoveryServicesBackup クライアント ライブラリ - バージョン 1.2.0

Azure Resource Manager RecoveryServicesBackup クライアント ライブラリ for Java。

このパッケージには、Microsoft Azure SDK for RecoveryServicesBackup Management SDK が含まれています。 Azure RecoveryServices Backup サービスの API 2.0 仕様を開きます。 パッケージ タグ package-2023-04。 このパッケージの使用方法に関するドキュメントについては、 Java 用 Azure 管理ライブラリに関するページを参照してください。

フィードバックをお寄せください

私たちは常に製品の改善とユーザーとのコミュニケーション方法に取り組んでいます。 だから、私たちは何が機能し、どのように私たちはより良い何ができるかを学ぶのが大好きです。

まだお持ちでない場合は、この 短いアンケートを完了 するまで数分お待ちください。

ご協力いただき、ありがとうございます。 私たちはあなたの時間を本当に感謝します!

ドキュメント

作業の開始に役立つさまざまなドキュメントが用意されています

作業の開始

前提条件

製品へのパッケージの追加

<dependency>
    <groupId>com.azure.resourcemanager</groupId>
    <artifactId>azure-resourcemanager-recoveryservicesbackup</artifactId>
    <version>1.2.0</version>
</dependency>

Azure 管理ライブラリには、認証の TokenCredential 実装と HTTP クライアントの実装が HttpClient 必要です。

Azure IdentityAzure Core Netty HTTP パッケージは、既定の実装を提供します。

認証

既定では、Azure Active Directory トークン認証は、次の環境変数の正しい構成に依存します。

  • AZURE_CLIENT_ID Azure クライアント ID の場合は 。
  • AZURE_TENANT_ID Azure テナント ID の場合は 。
  • AZURE_CLIENT_SECRET または AZURE_CLIENT_CERTIFICATE_PATH 、クライアント シークレットまたはクライアント証明書の場合は 。

さらに、Azure サブスクリプション ID は環境変数を使用して AZURE_SUBSCRIPTION_ID 構成できます。

上記の構成では、 azure 次のコードを使用してクライアントを認証できます。

AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE);
TokenCredential credential = new DefaultAzureCredentialBuilder()
    .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint())
    .build();
RecoveryServicesBackupManager manager = RecoveryServicesBackupManager
    .authenticate(credential, profile);

このサンプル コードでは、グローバル Azure を前提としています。 それ以外の場合は変数を変更 AzureEnvironment.AZURE してください。

その他のオプションについては、「 認証」 を参照してください。

主要な概念

Azure 管理ライブラリの設計と主要な概念の一般的な概要については、 API の設計 に関するページを参照してください。

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()
                                .withDaysOfTheWeek(Arrays.asList(DayOfWeek.SUNDAY))
                                .withWeeksOfTheMonth(Arrays.asList(WeekOfMonth.SECOND)))
                        .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()
                                .withDaysOfTheWeek(Arrays.asList(DayOfWeek.SUNDAY))
                                .withWeeksOfTheMonth(Arrays.asList(WeekOfMonth.LAST)))
                        .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))));

vault = recoveryServicesManager.vaults()
    .define(vaultName)
    .withRegion(REGION)
    .withExistingResourceGroup(resourceGroupName)
    .withSku(new Sku().withName(SkuName.RS0).withTier("Standard"))
    .withProperties(new VaultProperties()
        .withPublicNetworkAccess(PublicNetworkAccess.ENABLED)
        .withRestoreSettings(new RestoreSettings()
            .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)
    )
    .create();

コード スニペットとサンプル

トラブルシューティング

次のステップ

共同作成

このリポジトリへの投稿の詳細については、 投稿ガイドを参照してください。

このプロジェクトでは、共同作成と提案を歓迎しています。 ほとんどの共同作成では、共同作成者使用許諾契約書 (CLA) にご同意いただき、ご自身の共同作成内容を使用する権利を Microsoft に供与する権利をお持ちであり、かつ実際に供与することを宣言していただく必要があります。 詳細については、 https://cla.microsoft.com を参照してください。

pull request を送信すると、CLA を提供して PR (ラベル、コメントなど) を適宜装飾する必要があるかどうかを CLA ボットが自動的に決定します。 ボットによって提供される手順にそのまま従ってください。 これは、CLA を使用するすべてのリポジトリで 1 回だけ行う必要があります。

このプロジェクトでは、Microsoft オープン ソースの倫理規定を採用しています。 詳しくは、「Code of Conduct FAQ (倫理規定についてよくある質問)」を参照するか、opencode@microsoft.com 宛てに質問またはコメントをお送りください。

インプレッション数