github.com/verrazzano/verrazzano@v1.7.0/cluster-operator/controllers/quickcreate/controller/oci/fake/fake.go (about)

     1  // Copyright (c) 2023, Oracle and/or its affiliates.
     2  // Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
     3  
     4  package fake
     5  
     6  import (
     7  	"context"
     8  	"errors"
     9  	"github.com/oracle/oci-go-sdk/v53/core"
    10  	"github.com/verrazzano/verrazzano/cluster-operator/controllers/quickcreate/controller/oci"
    11  	"k8s.io/apimachinery/pkg/types"
    12  	clipkg "sigs.k8s.io/controller-runtime/pkg/client"
    13  )
    14  
    15  type (
    16  	CredentialsLoaderImpl struct {
    17  		Credentials *oci.Credentials
    18  	}
    19  	ClientImpl struct {
    20  		VCN                 *core.Vcn
    21  		AvailabilityDomains []oci.AvailabilityDomain
    22  	}
    23  )
    24  
    25  func (c *CredentialsLoaderImpl) GetCredentialsIfAllowed(_ context.Context, _ clipkg.Client, _ types.NamespacedName, _ string) (*oci.Credentials, error) {
    26  	return c.Credentials, nil
    27  }
    28  
    29  func (c *ClientImpl) GetSubnetByID(_ context.Context, id, role string) (*oci.Subnet, error) {
    30  	return &oci.Subnet{
    31  		ID:          id,
    32  		Role:        role,
    33  		Name:        role,
    34  		DisplayName: role,
    35  		CIDR:        "10.0.0.0/16",
    36  		Type:        "public",
    37  	}, nil
    38  }
    39  
    40  func (c *ClientImpl) GetVCNByID(_ context.Context, id string) (*core.Vcn, error) {
    41  	if id == *c.VCN.Id {
    42  		return c.VCN, nil
    43  	}
    44  	return nil, errors.New("vcn not found")
    45  }
    46  
    47  func (c *ClientImpl) GetAvailabilityAndFaultDomains(_ context.Context) ([]oci.AvailabilityDomain, error) {
    48  	return c.AvailabilityDomains, nil
    49  }