Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add source control force_uuid_mapping setting #39

Merged
merged 2 commits into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/resources/source_control_settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ resource "retool_source_control_settings" "scm_settings" {
custom_pull_request_template_enabled = true
custom_pull_request_template = "custom-pull-request-template"
version_control_locked = true
force_uuid_mapping = false
}
```

Expand All @@ -27,6 +28,7 @@ resource "retool_source_control_settings" "scm_settings" {
- `auto_branch_naming_enabled` (Boolean) When enabled, Retool automatically suggests a branch name on branch creation. Defaults to true.
- `custom_pull_request_template` (String) Pull requests created from Retool will use the template specified.
- `custom_pull_request_template_enabled` (Boolean) When enabled, Retool will use the template specified to create pull requests. Defaults to false.
- `force_uuid_mapping` (Boolean) When set to true, creates a uuid mapping for protected elements to be used in the source control repo. Defaults to false.
- `version_control_locked` (Boolean) When set to true, creates a read-only instance of Retool, where app editing is disabled. Defaults to false.

## Import
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ resource "retool_source_control_settings" "scm_settings" {
custom_pull_request_template_enabled = true
custom_pull_request_template = "custom-pull-request-template"
version_control_locked = true
force_uuid_mapping = false
}
10 changes: 10 additions & 0 deletions internal/provider/sourcecontrolsettings/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
CustomPullRequestTemplateEnabled types.Bool `tfsdk:"custom_pull_request_template_enabled"`
CustomPullRequestTemplate types.String `tfsdk:"custom_pull_request_template"`
VersionControlLocked types.Bool `tfsdk:"version_control_locked"`
ForceUuidMapping types.Bool `tfsdk:"force_uuid_mapping"`

Check failure on line 36 in internal/provider/sourcecontrolsettings/resource.go

View workflow job for this annotation

GitHub Actions / Checks

var-naming: struct field ForceUuidMapping should be ForceUUIDMapping (revive)
}

// Create new Source Control settings resource.
Expand Down Expand Up @@ -92,6 +93,12 @@
Description: "When set to true, creates a read-only instance of Retool, where app editing is disabled. Defaults to false.",
Default: booldefault.StaticBool(false),
},
"force_uuid_mapping": schema.BoolAttribute{
Optional: true,
Computed: true,
Description: "When set to true, creates a uuid mapping for protected elements to be used in the source control repo. Defaults to false.",
Default: booldefault.StaticBool(false),
},
},
}
}
Expand All @@ -103,6 +110,7 @@
CustomPullRequestTemplateEnabled: model.CustomPullRequestTemplateEnabled.ValueBoolPointer(),
CustomPullRequestTemplate: model.CustomPullRequestTemplate.ValueStringPointer(),
VersionControlLocked: model.VersionControlLocked.ValueBoolPointer(),
ForceUuidMapping: model.ForceUuidMapping.ValueBoolPointer(),
},
}

Expand Down Expand Up @@ -162,6 +170,7 @@
state.CustomPullRequestTemplateEnabled = types.BoolValue(response.Data.CustomPullRequestTemplateEnabled)
state.CustomPullRequestTemplate = types.StringValue(response.Data.CustomPullRequestTemplate)
state.VersionControlLocked = types.BoolValue(response.Data.VersionControlLocked)
state.ForceUuidMapping = types.BoolValue(response.Data.ForceUuidMapping)

diags := resp.State.Set(ctx, state)
resp.Diagnostics.Append(diags...)
Expand Down Expand Up @@ -205,6 +214,7 @@
CustomPullRequestTemplateEnabled: types.BoolValue(false),
CustomPullRequestTemplate: types.StringValue(""),
VersionControlLocked: types.BoolValue(false),
ForceUuidMapping: types.BoolValue(false),
}
updateSourceControlSettings(ctx, r.client, model, &resp.Diagnostics)
if resp.Diagnostics.HasError() {
Expand Down
9 changes: 7 additions & 2 deletions internal/provider/sourcecontrolsettings/resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ const testSCMSettings = `
custom_pull_request_template_enabled = true
custom_pull_request_template = "custom-pull-request-template"
version_control_locked = true
}
force_uuid_mapping = true
}
`

const testSCMSettingsUpdated = `
Expand All @@ -27,7 +28,8 @@ const testSCMSettingsUpdated = `
custom_pull_request_template_enabled = false
custom_pull_request_template = "custom-pull-request-template-updated"
version_control_locked = false
}
force_uuid_mapping = false
}
`

const testSCMSettingsDefaults = `
Expand All @@ -50,6 +52,7 @@ func TestAccSourceControlSettings(t *testing.T) {
resource.TestCheckResourceAttr("retool_source_control_settings.scm_settings", "custom_pull_request_template_enabled", "true"),
resource.TestCheckResourceAttr("retool_source_control_settings.scm_settings", "custom_pull_request_template", "custom-pull-request-template"),
resource.TestCheckResourceAttr("retool_source_control_settings.scm_settings", "version_control_locked", "true"),
resource.TestCheckResourceAttr("retool_source_control_settings.scm_settings", "force_uuid_mapping", "true"),
),
},
// Import state.
Expand All @@ -67,6 +70,7 @@ func TestAccSourceControlSettings(t *testing.T) {
resource.TestCheckResourceAttr("retool_source_control_settings.scm_settings", "custom_pull_request_template_enabled", "false"),
resource.TestCheckResourceAttr("retool_source_control_settings.scm_settings", "custom_pull_request_template", "custom-pull-request-template-updated"),
resource.TestCheckResourceAttr("retool_source_control_settings.scm_settings", "version_control_locked", "false"),
resource.TestCheckResourceAttr("retool_source_control_settings.scm_settings", "force_uuid_mapping", "false"),
),
},
// Use default values.
Expand All @@ -77,6 +81,7 @@ func TestAccSourceControlSettings(t *testing.T) {
resource.TestCheckResourceAttr("retool_source_control_settings.scm_settings", "custom_pull_request_template_enabled", "false"),
resource.TestCheckResourceAttr("retool_source_control_settings.scm_settings", "custom_pull_request_template", ""),
resource.TestCheckResourceAttr("retool_source_control_settings.scm_settings", "version_control_locked", "false"),
resource.TestCheckResourceAttr("retool_source_control_settings.scm_settings", "force_uuid_mapping", "false"),
),
},
},
Expand Down
23 changes: 23 additions & 0 deletions internal/sdk/api/api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2795,10 +2795,15 @@ components:
description: "When set to true, creates a read-only instance of Retool,\
\ where app editing is disabled. Defaults to false."
type: boolean
force_uuid_mapping:
description: "When set to true, creates a uuid mapping for protected elements\
\ to be used in the source control repo. Defaults to false."
type: boolean
required:
- auto_branch_naming_enabled
- custom_pull_request_template
- custom_pull_request_template_enabled
- force_uuid_mapping
- version_control_locked
type: object
app_theme:
Expand Down Expand Up @@ -6463,6 +6468,7 @@ components:
example:
custom_pull_request_template: custom_pull_request_template
version_control_locked: true
force_uuid_mapping: true
custom_pull_request_template_enabled: true
auto_branch_naming_enabled: true
properties:
Expand All @@ -6481,17 +6487,23 @@ components:
description: "When set to true, creates a read-only instance of Retool,\
\ where app editing is disabled. Defaults to false."
type: boolean
force_uuid_mapping:
description: "When set to true, creates a uuid mapping for protected elements\
\ to be used in the source control repo. Defaults to false."
type: boolean
required:
- auto_branch_naming_enabled
- custom_pull_request_template
- custom_pull_request_template_enabled
- force_uuid_mapping
- version_control_locked
type: object
_source_control_settings_get_200_response:
example:
data:
custom_pull_request_template: custom_pull_request_template
version_control_locked: true
force_uuid_mapping: true
custom_pull_request_template_enabled: true
auto_branch_naming_enabled: true
success: true
Expand Down Expand Up @@ -6523,6 +6535,10 @@ components:
description: "When set to true, creates a read-only instance of Retool,\
\ where app editing is disabled. Defaults to false."
type: boolean
force_uuid_mapping:
description: "When set to true, creates a uuid mapping for protected elements\
\ to be used in the source control repo. Defaults to false."
type: boolean
type: object
_source_control_settings_put_request:
additionalProperties: false
Expand All @@ -6538,6 +6554,7 @@ components:
example:
custom_pull_request_template: custom_pull_request_template
version_control_locked: true
force_uuid_mapping: true
custom_pull_request_template_enabled: true
auto_branch_naming_enabled: true
properties:
Expand All @@ -6556,17 +6573,23 @@ components:
description: "When set to true, creates a read-only instance of Retool,\
\ where app editing is disabled. Defaults to false."
type: boolean
force_uuid_mapping:
description: "When set to true, creates a uuid mapping for protected elements\
\ to be used in the source control repo. Defaults to false."
type: boolean
required:
- auto_branch_naming_enabled
- custom_pull_request_template
- custom_pull_request_template_enabled
- force_uuid_mapping
- version_control_locked
type: object
_source_control_settings_put_200_response:
example:
data:
custom_pull_request_template: custom_pull_request_template
version_control_locked: true
force_uuid_mapping: true
custom_pull_request_template_enabled: true
auto_branch_naming_enabled: true
success: true
Expand Down
23 changes: 22 additions & 1 deletion internal/sdk/api/docs/SourceControlSettings.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@ Name | Type | Description | Notes
**CustomPullRequestTemplateEnabled** | **bool** | When enabled, Retool will use the template specified to create pull requests. Defaults to false. |
**CustomPullRequestTemplate** | **string** | Pull requests created from Retool will use the template specified. |
**VersionControlLocked** | **bool** | When set to true, creates a read-only instance of Retool, where app editing is disabled. Defaults to false. |
**ForceUuidMapping** | **bool** | When set to true, creates a uuid mapping for protected elements to be used in the source control repo. Defaults to false. |

## Methods

### NewSourceControlSettings

`func NewSourceControlSettings(autoBranchNamingEnabled bool, customPullRequestTemplateEnabled bool, customPullRequestTemplate string, versionControlLocked bool, ) *SourceControlSettings`
`func NewSourceControlSettings(autoBranchNamingEnabled bool, customPullRequestTemplateEnabled bool, customPullRequestTemplate string, versionControlLocked bool, forceUuidMapping bool, ) *SourceControlSettings`

NewSourceControlSettings instantiates a new SourceControlSettings object
This constructor will assign default values to properties that have it defined,
Expand Down Expand Up @@ -108,6 +109,26 @@ and a boolean to check if the value has been set.
SetVersionControlLocked sets VersionControlLocked field to given value.


### GetForceUuidMapping

`func (o *SourceControlSettings) GetForceUuidMapping() bool`

GetForceUuidMapping returns the ForceUuidMapping field if non-nil, zero value otherwise.

### GetForceUuidMappingOk

`func (o *SourceControlSettings) GetForceUuidMappingOk() (*bool, bool)`

GetForceUuidMappingOk returns a tuple with the ForceUuidMapping field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.

### SetForceUuidMapping

`func (o *SourceControlSettings) SetForceUuidMapping(v bool)`

SetForceUuidMapping sets ForceUuidMapping field to given value.



[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

Expand Down
23 changes: 22 additions & 1 deletion internal/sdk/api/docs/SourceControlSettingsGet200ResponseData.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@ Name | Type | Description | Notes
**CustomPullRequestTemplateEnabled** | **bool** | When enabled, Retool will use the template specified to create pull requests. Defaults to false. |
**CustomPullRequestTemplate** | **string** | Pull requests created from Retool will use the template specified. |
**VersionControlLocked** | **bool** | When set to true, creates a read-only instance of Retool, where app editing is disabled. Defaults to false. |
**ForceUuidMapping** | **bool** | When set to true, creates a uuid mapping for protected elements to be used in the source control repo. Defaults to false. |

## Methods

### NewSourceControlSettingsGet200ResponseData

`func NewSourceControlSettingsGet200ResponseData(autoBranchNamingEnabled bool, customPullRequestTemplateEnabled bool, customPullRequestTemplate string, versionControlLocked bool, ) *SourceControlSettingsGet200ResponseData`
`func NewSourceControlSettingsGet200ResponseData(autoBranchNamingEnabled bool, customPullRequestTemplateEnabled bool, customPullRequestTemplate string, versionControlLocked bool, forceUuidMapping bool, ) *SourceControlSettingsGet200ResponseData`

NewSourceControlSettingsGet200ResponseData instantiates a new SourceControlSettingsGet200ResponseData object
This constructor will assign default values to properties that have it defined,
Expand Down Expand Up @@ -108,6 +109,26 @@ and a boolean to check if the value has been set.
SetVersionControlLocked sets VersionControlLocked field to given value.


### GetForceUuidMapping

`func (o *SourceControlSettingsGet200ResponseData) GetForceUuidMapping() bool`

GetForceUuidMapping returns the ForceUuidMapping field if non-nil, zero value otherwise.

### GetForceUuidMappingOk

`func (o *SourceControlSettingsGet200ResponseData) GetForceUuidMappingOk() (*bool, bool)`

GetForceUuidMappingOk returns a tuple with the ForceUuidMapping field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.

### SetForceUuidMapping

`func (o *SourceControlSettingsGet200ResponseData) SetForceUuidMapping(v bool)`

SetForceUuidMapping sets ForceUuidMapping field to given value.



[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

Expand Down
23 changes: 22 additions & 1 deletion internal/sdk/api/docs/SourceControlSettingsPut200ResponseData.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@ Name | Type | Description | Notes
**CustomPullRequestTemplateEnabled** | **bool** | When enabled, Retool will use the template specified to create pull requests. Defaults to false. |
**CustomPullRequestTemplate** | **string** | Pull requests created from Retool will use the template specified. |
**VersionControlLocked** | **bool** | When set to true, creates a read-only instance of Retool, where app editing is disabled. Defaults to false. |
**ForceUuidMapping** | **bool** | When set to true, creates a uuid mapping for protected elements to be used in the source control repo. Defaults to false. |

## Methods

### NewSourceControlSettingsPut200ResponseData

`func NewSourceControlSettingsPut200ResponseData(autoBranchNamingEnabled bool, customPullRequestTemplateEnabled bool, customPullRequestTemplate string, versionControlLocked bool, ) *SourceControlSettingsPut200ResponseData`
`func NewSourceControlSettingsPut200ResponseData(autoBranchNamingEnabled bool, customPullRequestTemplateEnabled bool, customPullRequestTemplate string, versionControlLocked bool, forceUuidMapping bool, ) *SourceControlSettingsPut200ResponseData`

NewSourceControlSettingsPut200ResponseData instantiates a new SourceControlSettingsPut200ResponseData object
This constructor will assign default values to properties that have it defined,
Expand Down Expand Up @@ -108,6 +109,26 @@ and a boolean to check if the value has been set.
SetVersionControlLocked sets VersionControlLocked field to given value.


### GetForceUuidMapping

`func (o *SourceControlSettingsPut200ResponseData) GetForceUuidMapping() bool`

GetForceUuidMapping returns the ForceUuidMapping field if non-nil, zero value otherwise.

### GetForceUuidMappingOk

`func (o *SourceControlSettingsPut200ResponseData) GetForceUuidMappingOk() (*bool, bool)`

GetForceUuidMappingOk returns a tuple with the ForceUuidMapping field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.

### SetForceUuidMapping

`func (o *SourceControlSettingsPut200ResponseData) SetForceUuidMapping(v bool)`

SetForceUuidMapping sets ForceUuidMapping field to given value.



[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

Expand Down
26 changes: 26 additions & 0 deletions internal/sdk/api/docs/SourceControlSettingsPutRequestSettings.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Name | Type | Description | Notes
**CustomPullRequestTemplateEnabled** | Pointer to **bool** | When enabled, Retool will use the template specified to create pull requests. Defaults to false. | [optional]
**CustomPullRequestTemplate** | Pointer to **string** | Pull requests created from Retool will use the template specified. | [optional]
**VersionControlLocked** | Pointer to **bool** | When set to true, creates a read-only instance of Retool, where app editing is disabled. Defaults to false. | [optional]
**ForceUuidMapping** | Pointer to **bool** | When set to true, creates a uuid mapping for protected elements to be used in the source control repo. Defaults to false. | [optional]

## Methods

Expand Down Expand Up @@ -128,6 +129,31 @@ SetVersionControlLocked sets VersionControlLocked field to given value.

HasVersionControlLocked returns a boolean if a field has been set.

### GetForceUuidMapping

`func (o *SourceControlSettingsPutRequestSettings) GetForceUuidMapping() bool`

GetForceUuidMapping returns the ForceUuidMapping field if non-nil, zero value otherwise.

### GetForceUuidMappingOk

`func (o *SourceControlSettingsPutRequestSettings) GetForceUuidMappingOk() (*bool, bool)`

GetForceUuidMappingOk returns a tuple with the ForceUuidMapping field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.

### SetForceUuidMapping

`func (o *SourceControlSettingsPutRequestSettings) SetForceUuidMapping(v bool)`

SetForceUuidMapping sets ForceUuidMapping field to given value.

### HasForceUuidMapping

`func (o *SourceControlSettingsPutRequestSettings) HasForceUuidMapping() bool`

HasForceUuidMapping returns a boolean if a field has been set.


[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

Expand Down
Loading
Loading