Skip to content

Commit

Permalink
CLOUDP-296190: [Flex Clusters] --targetProjectId is not handled prope…
Browse files Browse the repository at this point in the history
…rly (#3572)
  • Loading branch information
jeroenvervaeke authored Jan 22, 2025
1 parent 4dce94e commit 77b0248
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
9 changes: 7 additions & 2 deletions internal/cli/backup/restores/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,17 @@ func (opts *StartOpts) Run() error {
}

func (opts *StartOpts) newFlexBackupRestoreJobCreate() *admin.FlexBackupRestoreJobCreate20241113 {
return &admin.FlexBackupRestoreJobCreate20241113{
request := &admin.FlexBackupRestoreJobCreate20241113{
SnapshotId: opts.snapshotID,
TargetDeploymentItemName: opts.targetClusterName,
TargetProjectId: &opts.targetProjectID,
InstanceName: &opts.clusterName,
}

if opts.targetProjectID != "" {
request.TargetProjectId = &opts.targetProjectID
}

return request
}

func (opts *StartOpts) newCloudProviderSnapshotRestoreJob() *admin.DiskBackupSnapshotRestoreJob {
Expand Down
5 changes: 2 additions & 3 deletions internal/kubernetes/operator/project/project.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ func BuildAtlasProject(br *AtlasProjectBuildRequest) (*AtlasProjectResult, error
}

if br.Validator.FeatureExist(features.ResourceAtlasProject, featureCustomRoles) && !br.Validator.IsResourceSupported(features.ResourceAtlasCustomRole) {
customRoles, ferr := buildCustomRoles(br.ProjectStore, br.ProjectID)
customRoles, ferr := projectBuildCustomRoles(br.ProjectStore, br.ProjectID)
if ferr != nil {
return nil, ferr
}
Expand Down Expand Up @@ -275,8 +275,7 @@ func BuildProjectNamedConnectionSecret(credsProvider store.CredentialsGetter, na
return secret
}

//nolint:revive
func buildCustomRoles(crProvider store.DatabaseRoleLister, projectID string) ([]akov2.CustomRole, error) {
func projectBuildCustomRoles(crProvider store.DatabaseRoleLister, projectID string) ([]akov2.CustomRole, error) {
dbRoles, err := crProvider.DatabaseRoles(projectID)
if err != nil {
return nil, err
Expand Down
2 changes: 1 addition & 1 deletion internal/kubernetes/operator/project/project_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1510,7 +1510,7 @@ func Test_buildCustomRoles(t *testing.T) {
},
}

got, err := buildCustomRoles(rolesProvider, projectID)
got, err := projectBuildCustomRoles(rolesProvider, projectID)
if err != nil {
t.Fatalf("%v", err)
}
Expand Down

0 comments on commit 77b0248

Please sign in to comment.