Skip to content
This repository has been archived by the owner on Oct 14, 2024. It is now read-only.

Commit

Permalink
refactor(api): provider status (#1934)
Browse files Browse the repository at this point in the history
  • Loading branch information
adamtagscherer authored Jul 22, 2024
1 parent aefb3d8 commit c4263dd
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 6 deletions.
27 changes: 27 additions & 0 deletions api/types/providerstatus.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// Copyright © 2024 Cisco Systems, Inc. and its affiliates.
// All rights reserved.
//
// 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 types

import "time"

func NewProviderStatus(s ProviderStatusState, r ProviderStatusReason, m *string) *ProviderStatus {
return &ProviderStatus{
State: s,
Reason: r,
Message: m,
LastTransitionTime: time.Now(),
}
}
11 changes: 5 additions & 6 deletions e2e/provider_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ package e2e

import (
"fmt"
"time"

"github.com/onsi/ginkgo/v2"
"github.com/onsi/gomega"
Expand All @@ -36,11 +35,11 @@ var _ = ginkgo.Describe("Posting and getting a provider", func() {
ctx,
apitypes.Provider{
DisplayName: to.Ptr("test-provider"),
Status: to.Ptr(apitypes.ProviderStatus{
State: apitypes.ProviderStatusStateHealthy,
Reason: apitypes.HeartbeatReceived,
LastTransitionTime: time.Now(),
}),
Status: apitypes.NewProviderStatus(
apitypes.ProviderStatusStateHealthy,
apitypes.HeartbeatReceived,
nil,
),
})
gomega.Expect(err).NotTo(gomega.HaveOccurred())

Expand Down

0 comments on commit c4263dd

Please sign in to comment.