in server/internal/server/UpdateStorageAccount.go [14:43]
func (s *Server) UpdateStorageAccount(ctx context.Context, in *pb.UpdateStorageAccountRequest) (*pb.UpdateStorageAccountResponse, error) {
logger := ctxlogger.GetLogger(ctx)
if s.AccountsClient == nil {
logger.Error("AccountsClient is nil in UpdateStorageAccount(), azuresdk feature is likely disabled")
return nil, status.Errorf(codes.Unimplemented, "AccountsClient is nil in UpdateStorageAccount(), azuresdk feature is likely disabled")
}
tags := make(map[string]*string)
for k, v := range in.GetTags() {
tags[k] = to.Ptr(v)
}
params := armstorage.AccountUpdateParameters{
Tags: tags,
}
storageAccount, err := s.AccountsClient.Update(context.Background(), in.GetRgName(), in.GetSaName(), params, nil)
if err != nil {
logger.Error("Update() error: " + err.Error())
return nil, HandleError(err, "Update()")
}
updatedStorageAccount := &pb.StorageAccount{
Id: *storageAccount.ID,
Name: *storageAccount.Name,
Location: *storageAccount.Location,
}
logger.Info("Updated storage account: " + *storageAccount.Name)
return &pb.UpdateStorageAccountResponse{StorageAccount: updatedStorageAccount}, nil
}