Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Bp and BPA resources with examples to backupdr product #18

Merged
merged 3 commits into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
209 changes: 209 additions & 0 deletions mmv1/products/backupdr/BackupPlan.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,209 @@
# Copyright 2023 Google Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

name: 'BackupPlan'
base_url: projects/{{project}}/locations/{{location}}/backupPlans
create_url: projects/{{project}}/locations/{{location}}/backupPlans/?backup_plan_id={{backup_plan_id}}
self_link: projects/{{project}}/locations/{{location}}/backupPlans/{{backup_plan_id}}
immutable: true
delete_url: projects/{{project}}/locations/{{location}}/backupPlans/{{backup_plan_id}}
description: A backup plan defines when and how to back up a resource, including the backup's schedule, retention, and location.
references:
guides:
'Official Documentation': 'https://cloud.google.com/backup-disaster-recovery/docs'
api: 'https://cloud.google.com/backup-disaster-recovery/docs/reference/rest'
autogen_async: true
timeouts:
insert_minutes: 60
delete_minutes: 60
examples:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you move examples to the bottom of the file?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AS per convention they stay at top. Would you still want me to move it to bottom?

- min_version: beta
name: 'backup_dr_backup_plan'
primary_resource_id: 'my-backup-plan'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this same as the name? 🤔

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, primary_resource_id is tf resource name while name is example name

test_env_vars:
project: :PROJECT_NAME
exclude_test: true
parameters:
- name: 'location'
type: String
required: true
url_param_only: true
description: |
The location for the backup plan
- name: 'backup_plan_id'
type: String
required: true
url_param_only: true
description: |-
The ID of the backup plan
properties:
- name: 'name'
type: String
description: |
The name of backup plan resource created
output: true
- name: 'description'
type: String
description: |
The description allows for additional details about `BackupPlan` and its use cases to be provided.
- name: 'backupVault'
type: String
description: |
Backup vault where the backups gets stored using this Backup plan.
required: true
- name: 'backupVaultServiceAccount'
type: String
description: |
The Google Cloud Platform Service Account to be used by the BackupVault for taking backups.
output: true
- name: 'resourceType'
type: String
description: |
The resource type to which the `BackupPlan` will be applied. Examples include, "compute.googleapis.com/Instance" and "storage.googleapis.com/Bucket".
required: true
- name: 'createTime'
type: String
description: |
When the `BackupPlan` was created.
output: true
- name: 'updateTime'
type: String
description: |
When the `BackupPlan` was last updated.
output: true
- name: 'backupRules'
type: Array
description: |
The backup rules for this `BackupPlan`. There must be at least one `BackupRule` message.
required: true
item_type:
type: NestedObject
properties:
- name: 'ruleId'
type: String
description: The unique ID of this `BackupRule`. The `rule_id` is unique per `BackupPlan`.
required: true
- name: 'backupRetentionDays'
type: Integer
description: |
Configures the duration for which backup data will be kept. The value should be greater than or equal to minimum enforced retention of the backup vault.
required: true
- name: 'standardSchedule'
type: NestedObject
description: StandardSchedule defines a schedule that runs within the confines of a defined window of days.
required: true
properties:
- name: 'recurrenceType'
type: Enum
description: RecurrenceType enumerates the applicable periodicity for the schedule.
enum_values:
- HOURLY
- DAILY
- WEEKLY
- MONTHLY
- YEARLY
required: true
- name: 'hourlyFrequency'
type: Integer
description: |
Specifies frequency for hourly backups. An hourly frequency of 2 means jobs will run every 2 hours from start time till end time defined.
This is required for `recurrence_type`, `HOURLY` and is not applicable otherwise.
- name: 'daysOfWeek'
type: Array
description: 'Specifies days of week like MONDAY or TUESDAY, on which jobs will run. This is required for `recurrence_type`, `WEEKLY` and is not applicable otherwise.'
item_type:
type: Enum
name: 'DayOfWeekEnum'
description: 'Specifies day of week'
enum_values:
- DAY_OF_WEEK_UNSPECIFIED
- MONDAY
- TUESDAY
- WEDNESDAY
- THURSDAY
- FRIDAY
- SATURDAY
- name: 'daysOfMonth'
type: 'Array'
description: 'Specifies days of months like 1, 5, or 14 on which jobs will run.'
item_type:
type: Integer
- name: 'weekDayOfMonth'
type: NestedObject
description: 'Specifies a week day of the month like FIRST SUNDAY or LAST MONDAY, on which jobs will run.'
properties:
- name: 'weekOfMonth'
type: Enum
description: 'WeekOfMonth enumerates possible weeks in the month, e.g. the first, third, or last week of the month.'
enum_values:
- WEEK_OF_MONTH_UNSPECIFIED
- FIRST
- SECOND
- THIRD
- FOURTH
- LAST
required: true
- name: 'dayOfWeek'
type: Enum
description: 'Specifies the day of the week.'
enum_values:
- DAY_OF_WEEK_UNSPECIFIED
- MONDAY
- TUESDAY
- WEDNESDAY
- THURSDAY
- FRIDAY
- SATURDAY
- SUNDAY
required: true
- name: 'months'
type: Array
description: 'Specifies values of months'
item_type:
type: Enum
name: 'MonthEnum'
description: 'Specifies the months of the year, like `FEBRUARY` and/or `MAY`, on which jobs will run.'
enum_values:
- MONTH_UNSPECIFIED
- JANUARY
- FEBRUARY
- MARCH
- APRIL
- MAY
- JUNE
- JULY
- AUGUST
- SEPTEMBER
- OCTOBER
- NOVEMBER
- DECEMBER
- name: timeZone
type: String
description: The time zone to be used when interpreting the schedule.
required: true
- name: 'backupWindow'
type: NestedObject
description: |
A BackupWindow defines the window of the day during which backup jobs will run. Jobs are queued at the beginning of the window and will be marked as
`NOT_RUN` if they do not start by the end of the window.
properties:
- name: 'startHourOfDay'
type: Integer
description: |
The hour of the day (0-23) when the window starts, for example, if the value of the start hour of the day is 6, that means the backup window starts at 6:00.
required: true
- name: 'endHourOfDay'
type: Integer
description: |
The hour of the day (1-24) when the window ends, for example, if the value of end hour of the day is 10, that means the backup window end time is 10:00.
The end hour of the day should be greater than the start
121 changes: 121 additions & 0 deletions mmv1/products/backupdr/BackupPlanAssociation.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
# Copyright 2023 Google Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

name: 'BackupPlanAssociation'
min_version: beta
base_url: projects/{{project}}/locations/{{location}}/backupPlanAssociations
create_url: projects/{{project}}/locations/{{location}}/backupPlanAssociations/?backup_plan_association_id={{backup_plan_association_id}}
self_link: projects/{{project}}/locations/{{location}}/backupPlanAssociations/{{backup_plan_association_id}}
immutable: true
delete_url: projects/{{project}}/locations/{{location}}/backupPlanAssociations/{{backup_plan_association_id}}
description: A Backup and DR BackupPlanAssociation.
references:
guides:
'Official Documentation': 'https://cloud.google.com/backup-disaster-recovery/docs'
api: 'https://cloud.google.com/backup-disaster-recovery/docs/reference/rest'
autogen_async: true
timeouts:
insert_minutes: 60
delete_minutes: 60
examples:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move this to the bottom of the file

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is as per convention

- min_version: beta
name: 'backup_dr_bpa'
primary_resource_id: 'my-backup-plan'
test_env_vars:
project: :PROJECT_NAME
exclude_test: true
parameters:
- name: 'location'
type: String
required: true
url_param_only: true
description: |
The location for the backupplan association
- name: 'backup_plan_association_id'
type: String
required: true
url_param_only: true
description: |-
The id of backupplan association
properties:
- name: 'resource'
type: String
description: |
The resource for which BPA needs to be created
required: true
- name: 'name'
type: String
description: |
The name of backup plan association resource created
output: true
- name: 'backupPlan'
type: String
description: |
The BP with which resource needs to be created
required: true
- name: 'resourceType'
type: String
description: |
The resource type of workload on which backupplan is applied
output: true
- name: 'createTime'
type: String
description: |
The time when the instance was created
output: true
- name: 'updateTime'
type: String
description: |
The time when the instance was updated.
output: true
- name: 'dataSource'
type: String
description: |
Resource name of data source which will be used as storage location for backups taken
output: true
- name: 'rulesConfigInfo'
type: Array
description: |
Message for rules config info
item_type:
type: NestedObject
properties:
- name: 'ruleId'
type: String
description: Backup Rule id fetched from backup plan.
output: true
- name: 'lastBackupState'
type: Enum
description: State of last backup taken.
enum_values:
- :LAST_BACKUP_STATE_UNSPECIFIED
- :FIRST_BACKUP_PENDING
- :PERMISSION_DENIED
- :SUCCEEDED
- :FAILED
default_value: :LAST_BACKUP_STATE_UNSPECIFIED
- name: 'lastBackupError'
type: NestedObject
description: google.rpc.Status object to store the last backup error
output: true
properties:
- name: 'code'
type: String
description: The status code, which should be an enum value of [google.rpc.Code]
- name: 'message'
type: String
description: A developer-facing error message, which should be in English.
- name: 'lastSuccessfulBackupConsistencyTime'
type: String
description: The point in time when the last successful backup was captured from the source
output: true
Loading
Loading