github.com/caos/orbos@v1.5.14-0.20221103111702-e6cd0cea7ad4/internal/operator/boom/api/latest/reconciling/auth/google/google.go (about)

     1  package google
     2  
     3  import (
     4  	secret2 "github.com/caos/orbos/pkg/secret"
     5  )
     6  
     7  type Connector struct {
     8  	//Internal id of the google provider
     9  	ID string `json:"id,omitempty" yaml:"id,omitempty"`
    10  	//Internal name of the google provider
    11  	Name string `json:"name,omitempty" yaml:"name,omitempty"`
    12  	//Configuration for the google provider
    13  	Config *Config `json:"config,omitempty" yaml:"config,omitempty"`
    14  }
    15  
    16  func (c *Connector) IsZero() bool {
    17  	if c.ID == "" &&
    18  		c.Name == "" &&
    19  		(c.Config == nil || c.Config.IsZero()) {
    20  		return true
    21  	}
    22  
    23  	return false
    24  }
    25  
    26  type Config struct {
    27  	ClientID *secret2.Secret `json:"clientID,omitempty" yaml:"clientID,omitempty"`
    28  	//Existing secret with the clientID
    29  	ExistingClientIDSecret *secret2.Existing `json:"existingClientIDSecret,omitempty" yaml:"existingClientIDSecret,omitempty"`
    30  	ClientSecret           *secret2.Secret   `json:"clientSecret,omitempty" yaml:"clientSecret,omitempty"`
    31  	//Existing secret with the clientSecret
    32  	ExistingClientSecretSecret *secret2.Existing `json:"existingClientSecretSecret,omitempty" yaml:"existingClientSecretSecret,omitempty"`
    33  	//List of hosted domains which are permitted to login
    34  	HostedDomains []string `json:"hostedDomains,omitempty" yaml:"hostedDomains,omitempty"`
    35  	//List of groups in the hosted domains which are permitted to login
    36  	Groups             []string        `json:"groups,omitempty" yaml:"groups,omitempty"`
    37  	ServiceAccountJSON *secret2.Secret `json:"serviceAccountJSON,omitempty" yaml:"serviceAccountJSON,omitempty"`
    38  	//Existing secret with the JSON of the service account
    39  	ExistingServiceAccountJSONSecret *secret2.Existing `json:"existingServiceAccountJSONSecret,omitempty" yaml:"existingServiceAccountJSONSecret,omitempty"`
    40  	//File where the serviceAccountJSON will get persisted to impersonate G Suite admin
    41  	ServiceAccountFilePath string `json:"serviceAccountFilePath,omitempty" yaml:"serviceAccountFilePath,omitempty"`
    42  	//Email of a G Suite admin to impersonate
    43  	AdminEmail string `json:"adminEmail,omitempty" yaml:"adminEmail,omitempty"`
    44  }
    45  
    46  func (c *Config) IsZero() bool {
    47  	if (c.ClientID == nil || c.ClientID.IsZero()) &&
    48  		(c.ClientSecret == nil || c.ClientSecret.IsZero()) &&
    49  		(c.ServiceAccountJSON == nil || c.ServiceAccountJSON.IsZero()) &&
    50  		c.ExistingClientIDSecret == nil &&
    51  		c.ExistingClientSecretSecret == nil &&
    52  		c.ExistingServiceAccountJSONSecret == nil &&
    53  		c.HostedDomains == nil &&
    54  		c.Groups == nil &&
    55  		c.ServiceAccountFilePath == "" &&
    56  		c.AdminEmail == "" {
    57  		return true
    58  	}
    59  	return false
    60  }