func baremetalZone(server *scwbaremetal.Server) (cloudprovider.Zone, error) {
	zone := cloudprovider.Zone{
		Region:        string(server.Zone),
		FailureDomain: "unavailable",
	}
	return zone, nil
}
baremetalZone extract zone from the server
package scaleway
import (
	"context"
	scwbaremetal "github.com/scaleway/scaleway-sdk-go/api/baremetal/v1alpha1"
	"github.com/scaleway/scaleway-sdk-go/scw"
	v1 "k8s.io/api/core/v1"
	"k8s.io/apimachinery/pkg/types"
	cloudprovider "k8s.io/cloud-provider"
	"k8s.io/klog/v2"
)
type baremetal struct {
	api BaremetalAPI
}
type BaremetalAPI interface {
	ListServers(req *scwbaremetal.ListServersRequest, opts ...scw.RequestOption) (*scwbaremetal.ListServersResponse, error)
	GetServer(req *scwbaremetal.GetServerRequest, opts ...scw.RequestOption) (*scwbaremetal.Server, error)
	GetOffer(req *scwbaremetal.GetOfferRequest, opts ...scw.RequestOption) (*scwbaremetal.Offer, error)
}
func newBaremetal(client *client) *baremetal {
	return &baremetal{
		api: scwbaremetal.NewAPI(client.scaleway),
	}
}
func (b *baremetal) NodeAddresses(ctx context.Context, name types.NodeName) ([]v1.NodeAddress, error) {
	baremetalServer, err := b.getServerByName(string(name))
	if err != nil {
		return nil, err
	}
	return baremetalAddresses(baremetalServer), nil
}
func (b *baremetal) NodeAddressesByProviderID(ctx context.Context, providerID string) ([]v1.NodeAddress, error) {
	baremetalServer, err := b.getServerByProviderID(providerID)
	if err != nil {
		return nil, err
	}
	return baremetalAddresses(baremetalServer), nil
}
func (b *baremetal) InstanceID(ctx context.Context, nodeName types.NodeName) (string, error) {
	baremetalServer, err := b.getServerByName(string(nodeName))
	if err != nil {
		return "", err
	}
	return BuildProviderID(InstanceTypeBaremtal, string(baremetalServer.Zone), baremetalServer.ID), nil
}
func (b *baremetal) InstanceType(ctx context.Context, name types.NodeName) (string, error) {
	baremetalServer, err := b.getServerByName(string(name))
	if err != nil {
		return "", err
	}
	return b.getServerOfferName(baremetalServer)
}
func (b *baremetal) InstanceTypeByProviderID(ctx context.Context, providerID string) (string, error) {
	baremetalServer, err := b.getServerByProviderID(providerID)
	if err != nil {
		return "", err
	}
	return b.getServerOfferName(baremetalServer)
}
func (b *baremetal) AddSSHKeyToAllInstances(ctx context.Context, user string, keyData []byte) error {
	return cloudprovider.NotImplemented
}
func (b *baremetal) CurrentNodeName(ctx context.Context, hostname string) (types.NodeName, error) {
	return types.NodeName(hostname), nil
}
func (b *baremetal) InstanceExistsByProviderID(ctx context.Context, providerID string) (bool, error) {
	_, err := b.getServerByProviderID(providerID)
	if err != nil {
		if err == cloudprovider.InstanceNotFound {
			return false, nil
		}
		return false, err
	}
	return true, nil
}
func (b *baremetal) InstanceShutdownByProviderID(ctx context.Context, providerID string) (bool, error) {
	baremetalServer, err := b.getServerByProviderID(providerID)
	if err != nil {
		return false, err
	}
	if baremetalServer.Status == scwbaremetal.ServerStatusReady {
		return false, nil
	}
	return true, nil
}
func (b *baremetal) GetZoneByProviderID(ctx context.Context, providerID string) (cloudprovider.Zone, error) {
	baremetalServer, err := b.getServerByProviderID(providerID)
	if err != nil {
		return cloudprovider.Zone{Region: "", FailureDomain: ""}, err
	}
	return baremetalZone(baremetalServer)
}
func (b *baremetal) GetZoneByNodeName(ctx context.Context, nodeName types.NodeName) (cloudprovider.Zone, error) {
	baremetalServer, err := b.getServerByName(string(nodeName))
	if err != nil {
		return cloudprovider.Zone{Region: "", FailureDomain: ""}, err
	}
	return baremetalZone(baremetalServer)
}
func baremetalAddresses(server *scwbaremetal.Server) []v1.NodeAddress {
	addresses := []v1.NodeAddress{
		{Type: v1.NodeHostName, Address: server.Name},
	}
	for _, ip := range server.IPs {
		if ip.Version == scwbaremetal.IPVersionIPv4 {
			addresses = append(
				addresses,
				v1.NodeAddress{Type: v1.NodeExternalIP, Address: ip.Address.String()},
				v1.NodeAddress{Type: v1.NodeExternalDNS, Address: server.Domain},
			)
			break
		}
	}
	return addresses
}