You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: deployments_svc.go
    path of file: ./repos/pipeline/internal/ark
    
    the code of the file until where you have to start completion: // Copyright Â© 2018 Banzai Cloud
//
// 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.

package ark

import (
	"context"

	"emperror.dev/errors"
	"github.com/banzaicloud/integrated-service-sdk/api/v1alpha1"
	"github.com/jinzhu/gorm"
	"github.com/sirupsen/logrus"

	"github.com/banzaicloud/pipeline/internal/ark/api"
	"github.com/banzaicloud/pipeline/internal/ark/client"
	"github.com/banzaicloud/pipeline/internal/ark/providers/amazon"
	"github.com/banzaicloud/pipeline/internal/ark/providers/azure"
	"github.com/banzaicloud/pipeline/internal/ark/providers/google"
	"github.com/banzaicloud/pipeline/internal/global"
	"github.com/banzaicloud/pipeline/internal/integratedservices/services/backup"
	pkgErrors "github.com/banzaicloud/pipeline/pkg/errors"
	"github.com/banzaicloud/pipeline/pkg/providers"
	"github.com/banzaicloud/pipeline/src/auth"
	"github.com/banzaicloud/pipeline/src/cluster"
	"github.com/banzaicloud/pipeline/src/secret"
)

// DeploymentsService is for managing ARK deployments
type DeploymentsService struct {
	org        *auth.Organization
	cluster    api.Cluster
	repository *DeploymentsRepository
	logger     logrus.FieldLogger

	client *client.Client
}

type secretContents map[string]cluster.In
    
func (req ConfigRequest) getCredentialsSecret() (secretContents, error) {
	var config secretContents
	var BucketSecretContents string
	var ClusterSecretContents string
	var err error

	switch req.Cluster.Provider {
	case providers.Amazon:
		// In case of Amazon we set up one credential file with different profiles for cluster & bucket secret.
		// If UseClusterSecret is false there's no need for cluster secret, user will make sure node instance role has the right permissions
		ClusterSecretContents = ""
		if req.Bucket.Provider != providers.Amazon && req.UseClusterSecret {
			ClusterSecretContents, err = amazon.GetSecret(req.ClusterSecret, nil)
		}
		if err != nil {
			return config, nil
		}
	case providers.Google:
		ClusterSecretContents, err = google.GetSecret(req.ClusterSecret)
		if err != nil {
			return config, err
		}
	case providers.Azure:
		crgName := azure.GetAzureClusterResourceGroupName(req.Cluster.Distribution, req.Cluster.ResourceGroup, req.Cluster.Name, req.Cluster.Location)
		ClusterSecretContents, err = azure.GetSecretForCluster(req.ClusterSecret, crgName)
		if err != nil {
			return config, err
		}
	default:
		return config, pkgErrors.ErrorNotSupportedCloudType
	}

	switch req.Bucket.Provider {
	case providers.Amazon:
		var clusterSecret *secret.SecretItemResponse
		// put cluster secret if useClusterSecret == true otherwise will fallback to instance profile
		// which needs to be set up to contain snapshot permissions
		if req.Cluster.Provider == providers.Amazon && req.UseClusterSecret {
			clusterSecret = req.ClusterSecret
		}
		BucketSecretContents, err = amazon.GetSecret(clusterSecret, req.BucketSecret)
		if err != nil {
			return config, err
		}
	case providers.Google:
		BucketSecretContents, err = google.GetSecret(req.BucketSecret)
		if err != nil {
			return config, err
		}
	case providers.Azure:
		crgName := azure.GetAzureClusterResourceGroupName(req.Cluster.Distribution, req.Cluster.ResourceGroup, req.Cluster.Name, req.Cluster.Location)
		BucketSecretContents, err = azure.GetSecretForBucket(req.BucketSecret, req.Bucket.StorageAccount, req.Bucket.ResourceGroup, crgName)
		if err != nil {
			return config, err
		}
	default:
		return config, pkgErrors.ErrorNotSupportedCloudType
	}

	return secretContents{
		"cluster": cluster.InstallSecretRequestSpecItem{
			Value: ClusterSecretContents,
		},
		"cloud": cluster.InstallSecretRequestSpecItem{
			Value: BucketSecretContents,
		},
	}, err
}