Skip to content

Commit

Permalink
Merge pull request #122 from Scalr/feature/SCALRCORE-26905
Browse files Browse the repository at this point in the history
SCALRCORE-26905 Provider configurations > Google > Workload identity
  • Loading branch information
emocharnik committed Jul 11, 2023
2 parents 0f3cffe + 761a389 commit 9394b40
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 61 deletions.
131 changes: 70 additions & 61 deletions provider_configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,27 +32,30 @@ type ProviderConfigurationsList struct {

// ProviderConfiguration represents a Scalr provider configuration.
type ProviderConfiguration struct {
ID string `jsonapi:"primary,provider-configurations"`
Name string `jsonapi:"attr,name"`
ProviderName string `jsonapi:"attr,provider-name"`
ExportShellVariables bool `jsonapi:"attr,export-shell-variables"`
IsShared bool `jsonapi:"attr,is-shared"`
IsCustom bool `jsonapi:"attr,is-custom"`
AwsAccessKey string `jsonapi:"attr,aws-access-key"`
AwsSecretKey string `jsonapi:"attr,aws-secret-key"`
AwsAccountType string `jsonapi:"attr,aws-account-type"`
AwsCredentialsType string `jsonapi:"attr,aws-credentials-type"`
AwsTrustedEntityType string `jsonapi:"attr,aws-trusted-entity-type"`
AwsRoleArn string `jsonapi:"attr,aws-role-arn"`
AwsExternalId string `jsonapi:"attr,aws-external-id"`
AzurermClientId string `jsonapi:"attr,azurerm-client-id"`
AzurermClientSecret string `jsonapi:"attr,azurerm-client-secret"`
AzurermSubscriptionId string `jsonapi:"attr,azurerm-subscription-id"`
AzurermTenantId string `jsonapi:"attr,azurerm-tenant-id"`
GoogleProject string `jsonapi:"attr,google-project"`
GoogleCredentials string `jsonapi:"attr,google-credentials"`
ScalrHostname string `jsonapi:"attr,scalr-hostname"`
ScalrToken string `jsonapi:"attr,scalr-token"`
ID string `jsonapi:"primary,provider-configurations"`
Name string `jsonapi:"attr,name"`
ProviderName string `jsonapi:"attr,provider-name"`
ExportShellVariables bool `jsonapi:"attr,export-shell-variables"`
IsShared bool `jsonapi:"attr,is-shared"`
IsCustom bool `jsonapi:"attr,is-custom"`
AwsAccessKey string `jsonapi:"attr,aws-access-key"`
AwsSecretKey string `jsonapi:"attr,aws-secret-key"`
AwsAccountType string `jsonapi:"attr,aws-account-type"`
AwsCredentialsType string `jsonapi:"attr,aws-credentials-type"`
AwsTrustedEntityType string `jsonapi:"attr,aws-trusted-entity-type"`
AwsRoleArn string `jsonapi:"attr,aws-role-arn"`
AwsExternalId string `jsonapi:"attr,aws-external-id"`
AzurermClientId string `jsonapi:"attr,azurerm-client-id"`
AzurermClientSecret string `jsonapi:"attr,azurerm-client-secret"`
AzurermSubscriptionId string `jsonapi:"attr,azurerm-subscription-id"`
AzurermTenantId string `jsonapi:"attr,azurerm-tenant-id"`
GoogleAuthType string `jsonapi:"attr,google-auth-type"`
GoogleServiceAccountEmail string `jsonapi:"attr,google-service-account-email"`
GoogleWorkloadProviderName string `jsonapi:"attr,google-workload-provider-name"`
GoogleProject string `jsonapi:"attr,google-project"`
GoogleCredentials string `jsonapi:"attr,google-credentials"`
ScalrHostname string `jsonapi:"attr,scalr-hostname"`
ScalrToken string `jsonapi:"attr,scalr-token"`

Account *Account `jsonapi:"relation,account"`
Parameters []*ProviderConfigurationParameter `jsonapi:"relation,parameters"`
Expand Down Expand Up @@ -94,27 +97,30 @@ func (s *providerConfigurations) List(ctx context.Context, options ProviderConfi

// ProviderConfigurationCreateOptions represents the options for creating a new provider configuration.
type ProviderConfigurationCreateOptions struct {
ID string `jsonapi:"primary,provider-configurations"`
Name *string `jsonapi:"attr,name"`
ProviderName *string `jsonapi:"attr,provider-name"`
ExportShellVariables *bool `jsonapi:"attr,export-shell-variables,omitempty"`
IsShared *bool `jsonapi:"attr,is-shared,omitempty"`
IsCustom *bool `jsonapi:"attr,is-custom,omitempty"`
AwsAccessKey *string `jsonapi:"attr,aws-access-key,omitempty"`
AwsSecretKey *string `jsonapi:"attr,aws-secret-key,omitempty"`
AwsAccountType *string `jsonapi:"attr,aws-account-type"`
AwsCredentialsType *string `jsonapi:"attr,aws-credentials-type"`
AwsTrustedEntityType *string `jsonapi:"attr,aws-trusted-entity-type"`
AwsRoleArn *string `jsonapi:"attr,aws-role-arn"`
AwsExternalId *string `jsonapi:"attr,aws-external-id"`
AzurermClientId *string `jsonapi:"attr,azurerm-client-id,omitempty"`
AzurermClientSecret *string `jsonapi:"attr,azurerm-client-secret,omitempty"`
AzurermSubscriptionId *string `jsonapi:"attr,azurerm-subscription-id,omitempty"`
AzurermTenantId *string `jsonapi:"attr,azurerm-tenant-id,omitempty"`
GoogleProject *string `jsonapi:"attr,google-project,omitempty"`
GoogleCredentials *string `jsonapi:"attr,google-credentials,omitempty"`
ScalrHostname *string `jsonapi:"attr,scalr-hostname,omitempty"`
ScalrToken *string `jsonapi:"attr,scalr-token,omitempty"`
ID string `jsonapi:"primary,provider-configurations"`
Name *string `jsonapi:"attr,name"`
ProviderName *string `jsonapi:"attr,provider-name"`
ExportShellVariables *bool `jsonapi:"attr,export-shell-variables,omitempty"`
IsShared *bool `jsonapi:"attr,is-shared,omitempty"`
IsCustom *bool `jsonapi:"attr,is-custom,omitempty"`
AwsAccessKey *string `jsonapi:"attr,aws-access-key,omitempty"`
AwsSecretKey *string `jsonapi:"attr,aws-secret-key,omitempty"`
AwsAccountType *string `jsonapi:"attr,aws-account-type"`
AwsCredentialsType *string `jsonapi:"attr,aws-credentials-type"`
AwsTrustedEntityType *string `jsonapi:"attr,aws-trusted-entity-type"`
AwsRoleArn *string `jsonapi:"attr,aws-role-arn"`
AwsExternalId *string `jsonapi:"attr,aws-external-id"`
AzurermClientId *string `jsonapi:"attr,azurerm-client-id,omitempty"`
AzurermClientSecret *string `jsonapi:"attr,azurerm-client-secret,omitempty"`
AzurermSubscriptionId *string `jsonapi:"attr,azurerm-subscription-id,omitempty"`
AzurermTenantId *string `jsonapi:"attr,azurerm-tenant-id,omitempty"`
GoogleAuthType *string `jsonapi:"attr,google-auth-type,omitempty"`
GoogleServiceAccountEmail *string `jsonapi:"attr,google-service-account-email,omitempty"`
GoogleWorkloadProviderName *string `jsonapi:"attr,google-workload-provider-name,omitempty"`
GoogleProject *string `jsonapi:"attr,google-project,omitempty"`
GoogleCredentials *string `jsonapi:"attr,google-credentials,omitempty"`
ScalrHostname *string `jsonapi:"attr,scalr-hostname,omitempty"`
ScalrToken *string `jsonapi:"attr,scalr-token,omitempty"`

Account *Account `jsonapi:"relation,account,omitempty"`
Environments []*Environment `jsonapi:"relation,environments,omitempty"`
Expand Down Expand Up @@ -167,25 +173,28 @@ func (s *providerConfigurations) Read(ctx context.Context, configurationID strin
type ProviderConfigurationUpdateOptions struct {
ID string `jsonapi:"primary,provider-configurations"`

Name *string `jsonapi:"attr,name"`
IsShared *bool `jsonapi:"attr,is-shared,omitempty"`
Environments []*Environment `jsonapi:"relation,environments"`
ExportShellVariables *bool `jsonapi:"attr,export-shell-variables"`
AwsAccessKey *string `jsonapi:"attr,aws-access-key"`
AwsSecretKey *string `jsonapi:"attr,aws-secret-key"`
AwsAccountType *string `jsonapi:"attr,aws-account-type"`
AwsCredentialsType *string `jsonapi:"attr,aws-credentials-type"`
AwsTrustedEntityType *string `jsonapi:"attr,aws-trusted-entity-type"`
AwsRoleArn *string `jsonapi:"attr,aws-role-arn"`
AwsExternalId *string `jsonapi:"attr,aws-external-id"`
AzurermClientId *string `jsonapi:"attr,azurerm-client-id"`
AzurermClientSecret *string `jsonapi:"attr,azurerm-client-secret"`
AzurermSubscriptionId *string `jsonapi:"attr,azurerm-subscription-id"`
AzurermTenantId *string `jsonapi:"attr,azurerm-tenant-id"`
GoogleProject *string `jsonapi:"attr,google-project"`
GoogleCredentials *string `jsonapi:"attr,google-credentials"`
ScalrHostname *string `jsonapi:"attr,scalr-hostname"`
ScalrToken *string `jsonapi:"attr,scalr-token"`
Name *string `jsonapi:"attr,name"`
IsShared *bool `jsonapi:"attr,is-shared,omitempty"`
Environments []*Environment `jsonapi:"relation,environments"`
ExportShellVariables *bool `jsonapi:"attr,export-shell-variables"`
AwsAccessKey *string `jsonapi:"attr,aws-access-key"`
AwsSecretKey *string `jsonapi:"attr,aws-secret-key"`
AwsAccountType *string `jsonapi:"attr,aws-account-type"`
AwsCredentialsType *string `jsonapi:"attr,aws-credentials-type"`
AwsTrustedEntityType *string `jsonapi:"attr,aws-trusted-entity-type"`
AwsRoleArn *string `jsonapi:"attr,aws-role-arn"`
AwsExternalId *string `jsonapi:"attr,aws-external-id"`
AzurermClientId *string `jsonapi:"attr,azurerm-client-id"`
AzurermClientSecret *string `jsonapi:"attr,azurerm-client-secret"`
AzurermSubscriptionId *string `jsonapi:"attr,azurerm-subscription-id"`
AzurermTenantId *string `jsonapi:"attr,azurerm-tenant-id"`
GoogleAuthType *string `jsonapi:"attr,google-auth-type"`
GoogleServiceAccountEmail *string `jsonapi:"attr,google-service-account-email"`
GoogleWorkloadProviderName *string `jsonapi:"attr,google-workload-provider-name"`
GoogleProject *string `jsonapi:"attr,google-project"`
GoogleCredentials *string `jsonapi:"attr,google-credentials"`
ScalrHostname *string `jsonapi:"attr,scalr-hostname"`
ScalrToken *string `jsonapi:"attr,scalr-token"`
}

// Update an existing provider configuration.
Expand Down
1 change: 1 addition & 0 deletions provider_configuration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@ func TestProviderConfigurationCreateGoogle(t *testing.T) {
assert.Equal(t, *options.ExportShellVariables, pcfg.ExportShellVariables)
assert.Equal(t, *options.GoogleProject, pcfg.GoogleProject)
assert.Equal(t, "", pcfg.GoogleCredentials)
assert.Equal(t, "service-account-key", pcfg.GoogleAuthType)
})
}

Expand Down

0 comments on commit 9394b40

Please sign in to comment.