This repository has been archived by the owner on Oct 14, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: initial version of provider v2 * feat: add feature flag support to go builds * fix: binary builds with CGO enabled
- Loading branch information
1 parent
2e98ed5
commit 493fc1f
Showing
22 changed files
with
589 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
// Copyright © 2023 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. | ||
|
||
//go:build !providerv2 | ||
|
||
package orchestrator | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
|
||
apitypes "github.com/openclarity/vmclarity/api/types" | ||
"github.com/openclarity/vmclarity/provider" | ||
"github.com/openclarity/vmclarity/provider/aws" | ||
"github.com/openclarity/vmclarity/provider/azure" | ||
"github.com/openclarity/vmclarity/provider/docker" | ||
"github.com/openclarity/vmclarity/provider/external" | ||
"github.com/openclarity/vmclarity/provider/gcp" | ||
"github.com/openclarity/vmclarity/provider/kubernetes" | ||
) | ||
|
||
// nolint:wrapcheck | ||
// NewProvider returns an initialized provider.Provider based on the kind apitypes.CloudProvider. | ||
func NewProvider(ctx context.Context, kind apitypes.CloudProvider) (provider.Provider, error) { | ||
switch kind { | ||
case apitypes.Azure: | ||
return azure.New(ctx) | ||
case apitypes.Docker: | ||
return docker.New(ctx) | ||
case apitypes.AWS: | ||
return aws.New(ctx) | ||
case apitypes.GCP: | ||
return gcp.New(ctx) | ||
case apitypes.External: | ||
return external.New(ctx) | ||
case apitypes.Kubernetes: | ||
return kubernetes.New(ctx) | ||
default: | ||
return nil, fmt.Errorf("unsupported provider: %s", kind) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
// Copyright © 2023 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. | ||
|
||
//go:build providerv2 | ||
|
||
package orchestrator | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
|
||
apitypes "github.com/openclarity/vmclarity/api/types" | ||
provider2 "github.com/openclarity/vmclarity/provider" | ||
"github.com/openclarity/vmclarity/provider/docker" | ||
"github.com/openclarity/vmclarity/provider/external" | ||
"github.com/openclarity/vmclarity/provider/kubernetes" | ||
"github.com/openclarity/vmclarity/provider/v2/aws" | ||
"github.com/openclarity/vmclarity/provider/v2/azure" | ||
"github.com/openclarity/vmclarity/provider/v2/gcp" | ||
) | ||
|
||
// nolint:wrapcheck | ||
// NewProvider returns an initialized provider.Provider based on the kind apitypes.CloudProvider. | ||
func NewProvider(ctx context.Context, kind apitypes.CloudProvider) (provider2.Provider, error) { | ||
switch kind { | ||
case apitypes.Azure: | ||
return azure.New(ctx) | ||
case apitypes.Docker: | ||
return docker.New(ctx) | ||
case apitypes.AWS: | ||
return aws.New(ctx) | ||
case apitypes.GCP: | ||
return gcp.New(ctx) | ||
case apitypes.External: | ||
return external.New(ctx) | ||
case apitypes.Kubernetes: | ||
return kubernetes.New(ctx) | ||
default: | ||
return nil, fmt.Errorf("unsupported provider: %s", kind) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// Copyright © 2023 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 discoverer | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/openclarity/vmclarity/provider" | ||
) | ||
|
||
var _ provider.Discoverer = &Discoverer{} | ||
|
||
type Discoverer struct{} | ||
|
||
func (d *Discoverer) DiscoverAssets(ctx context.Context) provider.AssetDiscoverer { | ||
// TODO implement me | ||
panic("implement me") | ||
} |
Oops, something went wrong.