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

Deeksha/add imports #5819

Merged
merged 87 commits into from
Dec 26, 2024
Merged

Conversation

IBM-Deeksha
Copy link
Contributor

datasources and resources for new backup and recovery service

Community Note

  • Please vote on this pull request by adding a 👍 reaction to the original pull request comment to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for pull request followers and do not help prioritize the request

Relates OR Closes #0000

Output from acceptance testing:

$ make testacc TESTARGS='-run=TestAccXXX'

...

@IBM-Deeksha
Copy link
Contributor Author

IBM-Deeksha commented Nov 27, 2024

Regression Results:

PASS TestAccIbmBackupRecoverySourceRegistrationBasic (44 89s) Pasted Graphic 33 Pasted Graphic 34 Pasted Graphic 35 Pasted Graphic 36 Pasted Graphic 37 Pasted Graphic 38 Pasted Graphic 39 34 981s Pasted Graphic 41 Pasted Graphic 44 Pasted Graphic 42 TestAccIbeBackupRecoveryPerformAction0nProtectionGroupRunRequestBasic Pasted Graphic 45 Pasted Graphic 46 Pasted Graphic 47 Pasted Graphic 48 Pasted Graphic 50 TestAccibeBackupRecoveryDataSourceConnectorsDataSourceBasic TestAccIbeBackupRecoveryConnectorsMetadataDataSourceBasic Pasted Graphic 52 Pasted Graphic 53 Pasted Graphic 54 Pasted Graphic 55 TestAccIbmBackupRecoveryAgentUpgradeTasksDataSourceBasic Pasted Graphic 57 Pasted Graphic 58 Pasted Graphic 59 image

@IBM-Deeksha
Copy link
Contributor Author

Regression results:
Pasted Graphic 61
Pasted Graphic 62
Pasted Graphic 63
Pasted Graphic 65
Pasted Graphic 66
Pasted Graphic 67
Pasted Graphic 68
Pasted Graphic 69
Pasted Graphic 70
Pasted Graphic 72
Pasted Graphic 71
Pasted Graphic 73
Pasted Graphic 81
Pasted Graphic 82
Pasted Graphic 80
Pasted Graphic 84
Pasted Graphic 85
Pasted Graphic 83
Pasted Graphic 75
(21 95s)
Pasted Graphic 77

@IBM-Deeksha
Copy link
Contributor Author

IBM-Deeksha commented Dec 12, 2024

Regression result for resource ibm_backup_recovery_perform_action_on_protection_group_run_request

image

hkantare
hkantare previously approved these changes Dec 17, 2024

backupRecoveryClientOptions := &backuprecoveryv1.BackupRecoveryV1Options{
Authenticator: authenticator,
URL: EnvFallBack([]string{"BACKUP_RECOVERY_ENDPOINT"}, backupRecoveryURL),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Append IBMCLOUD_ for this BACKUP_RECOVERY_ENDPOINT to keep in sync with all endpoints

@@ -1592,6 +1603,30 @@ func (c *Config) ClientSession() (interface{}, error) {
}
}

// Construct the service options.
backupRecoveryURL := "https://brs-stage-us-south-02.backup-recovery.test.cloud.ibm.com/v2"
Copy link
Collaborator

Choose a reason for hiding this comment

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

why are we hardcoding stage endpoint.By default the provider shd target production endpoint

Copy link
Contributor Author

Choose a reason for hiding this comment

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

backupRecoveryURL varies according to the the cluster created. So for end user (or different tenant), the backupRecoveryURL would be different. I will add a check to validate if it has been provided or not via environment variable or endpoints file.

Required: true,
Description: "Specifies the key to be used to encrypt the source credential. If includeSourceCredentials is set to true this key must be specified.",
},
"connector_ids": &schema.Schema{
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we provide connector_ids and connector_names, and connection_id all together or only one is supported at a time if so can you add conflicts_with , or some other options to control the behaviour

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We can provide the following combinations:

  • connection_id and connector_names
  • connector_ids and connector_names
    But cannot provide :
  • connection_id and connector_ids

Will add conflictsWith for connection_id and connector_ids

Optional: true,
Description: "Specifies the type of request from UI, which is used for services like magneto to determine the priority of requests.",
},
"ids": &schema.Schema{
Copy link
Collaborator

Choose a reason for hiding this comment

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

same as above comment can we provide "ids" and "policy_names" together

Copy link
Collaborator

Choose a reason for hiding this comment

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

May be generic comment check for all datasources/resources

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes @hkantare
We can provide both ids and policy_names together. The API first filter out the policies based on ids and then proceed to match the names defined in policy_names. If a policy matching both the values is present then it is listed otherwise we get an empty policy list. In this case the API does not throw any error.

return nil
}

func ResourceIbmBackupRecoveryValidator() *validate.ResourceValidator {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Are we using this validation?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No @hkantare .I will remove it from the code.

}

getRecoveryByIdOptions := &backuprecoveryv1.GetRecoveryByIdOptions{}
tenantId := d.Get("x_ibm_tenant_id").(string)
Copy link
Collaborator

Choose a reason for hiding this comment

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

In Read we should avoid doing d.Get it effects the import flow
Already as part of d.SetID we store tenantID why can't we use that?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes @hkantare , have extracted and used the tenant Id from d.Id() and used it to set the same variable tenantId = ParseId(d.Id(), "tenantId")

// ForceNew: true,
Description: "Specifies the key to be used to encrypt the source credential. If includeSourceCredentials is set to true this key must be specified.",
},
"registration_token": &schema.Schema{
Copy link
Collaborator

Choose a reason for hiding this comment

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

If this is secret value can we add sensitive : true so it mask the value in logs/output

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@hkantare a connection registration_token is something the user would like to use for registering connectors on this connection. So we would require this in output.

page_title: "IBM : ibm_backup_recoveries"
description: |-
Get information about List of Recoveries.
subcategory: "IBM Backup Recovery API"
Copy link
Collaborator

Choose a reason for hiding this comment

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

can we remove the word API from subcategory this names is use to group the res/ds in registry docs.

can we add this allowed-subcategoreis since its new service

```
import {
to = <ibm_backup_recovery_resource>
id = "<tenantId>:<recovery_id>"
Copy link
Collaborator

Choose a reason for hiding this comment

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

here we have single colon but in resources we are spiting by ("::")
document the separator correctly most of resource goes with ("/") or (":") any specific reason for ("::")

Copy link
Contributor Author

@IBM-Deeksha IBM-Deeksha Dec 18, 2024

Choose a reason for hiding this comment

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

yes @hkantare
The values of tenantId generally contains a '/' (like "jhxqx715r9/") and a lot resource Ids like recoveryId, policyId, groupIds etc. contains ":" (ex. a policy Id generally looks like this "5170815044477768:1732541085048:15126")
Since both '/' and ":" are present in tenantId and resourceId values, we have used "::"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also, I'll update id = "<tenantId>: to id = "<tenantId>:: in documentation


import {
to = ibm_backup_recovery.backup_recovery_instance
id = "jhxqx715r9/::5170815044477768:1732541085048:484"
Copy link
Collaborator

Choose a reason for hiding this comment

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

here I see both "/::" even / is separator or value of tenantID?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's the value of tenantID

Deeksha Sharma added 2 commits December 18, 2024 12:06
Please enter the commit message for your changes. Lines starting
@IBM-Deeksha
Copy link
Contributor Author

Regression result:
Pasted Graphic 86

hkantare
hkantare previously approved these changes Dec 24, 2024
@hkantare hkantare merged commit 751cab1 into IBM-Cloud:master Dec 26, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants