-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into hhe-table-rework
# Conflicts: # go.mod # go.sum
- Loading branch information
Showing
15 changed files
with
844 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
--- | ||
# generated by https://github.com/hashicorp/terraform-plugin-docs | ||
page_title: "pinot_clusters Data Source - terraform-provider-pinot" | ||
subcategory: "" | ||
description: |- | ||
--- | ||
|
||
# pinot_clusters (Data Source) | ||
|
||
|
||
|
||
|
||
|
||
<!-- schema generated by tfplugindocs --> | ||
## Schema | ||
|
||
### Read-Only | ||
|
||
- `cluster_config` (Attributes) The configuration of the Pinot cluster. (see [below for nested schema](#nestedatt--cluster_config)) | ||
- `cluster_name` (String) The name of the Pinot cluster. | ||
|
||
<a id="nestedatt--cluster_config"></a> | ||
### Nested Schema for `cluster_config` | ||
|
||
Read-Only: | ||
|
||
- `allow_participant_auto_join` (String) | ||
- `default_hyperlog_log_log2m` (String) | ||
- `enable_case_insensitive` (String) | ||
- `pinot_broker_enable_query_limit_override` (String) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
--- | ||
# generated by https://github.com/hashicorp/terraform-plugin-docs | ||
page_title: "pinot_instances Data Source - terraform-provider-pinot" | ||
subcategory: "" | ||
description: |- | ||
--- | ||
|
||
# pinot_instances (Data Source) | ||
|
||
|
||
|
||
|
||
|
||
<!-- schema generated by tfplugindocs --> | ||
## Schema | ||
|
||
### Read-Only | ||
|
||
- `instances` (Attributes List) The list of instances. (see [below for nested schema](#nestedatt--instances)) | ||
|
||
<a id="nestedatt--instances"></a> | ||
### Nested Schema for `instances` | ||
|
||
Read-Only: | ||
|
||
- `admin_port` (Number) The admin port of the instance. | ||
- `enabled` (Boolean) If the instance is enabled. | ||
- `grpc_port` (Number) The GRPC port of the instance. | ||
- `host_name` (String) The hostname of the instance. | ||
- `instance_name` (String) The name of the instance. | ||
- `pools` (List of String) The list of pools. | ||
- `port` (String) The port of the instance. | ||
- `query_mailbox_port` (Number) The query mailbox port of the instance. | ||
- `query_service_port` (Number) The query server port of the instance. | ||
- `system_resource_info` (Attributes) The role of the user. (see [below for nested schema](#nestedatt--instances--system_resource_info)) | ||
- `tags` (List of String) The list of tags. | ||
|
||
<a id="nestedatt--instances--system_resource_info"></a> | ||
### Nested Schema for `instances.system_resource_info` | ||
|
||
Read-Only: | ||
|
||
- `max_heap_size_mb` (String) The max heap size in MB. | ||
- `num_cores` (String) The number of cores. | ||
- `total_memory_mb` (String) The total memory in MB. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
--- | ||
# generated by https://github.com/hashicorp/terraform-plugin-docs | ||
page_title: "pinot_segments Data Source - terraform-provider-pinot" | ||
subcategory: "" | ||
description: |- | ||
--- | ||
|
||
# pinot_segments (Data Source) | ||
|
||
|
||
|
||
|
||
|
||
<!-- schema generated by tfplugindocs --> | ||
## Schema | ||
|
||
### Required | ||
|
||
- `table_name` (String) The name of the table to get segments for | ||
|
||
### Read-Only | ||
|
||
- `offline_segments` (Attributes List) The list of offline segments. (see [below for nested schema](#nestedatt--offline_segments)) | ||
- `realtime_segments` (Attributes List) The list of realtime segments. (see [below for nested schema](#nestedatt--realtime_segments)) | ||
|
||
<a id="nestedatt--offline_segments"></a> | ||
### Nested Schema for `offline_segments` | ||
|
||
Read-Only: | ||
|
||
- `segment_name` (String) The name of the segment. | ||
|
||
|
||
<a id="nestedatt--realtime_segments"></a> | ||
### Nested Schema for `realtime_segments` | ||
|
||
Read-Only: | ||
|
||
- `segment_name` (String) The name of the segment. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
--- | ||
# generated by https://github.com/hashicorp/terraform-plugin-docs | ||
page_title: "pinot_tenants Data Source - terraform-provider-pinot" | ||
subcategory: "" | ||
description: |- | ||
--- | ||
|
||
# pinot_tenants (Data Source) | ||
|
||
|
||
|
||
|
||
|
||
<!-- schema generated by tfplugindocs --> | ||
## Schema | ||
|
||
### Read-Only | ||
|
||
- `broker_tenants` (Attributes List) Broker tenants (see [below for nested schema](#nestedatt--broker_tenants)) | ||
- `server_tenants` (Attributes List) Server tenants (see [below for nested schema](#nestedatt--server_tenants)) | ||
|
||
<a id="nestedatt--broker_tenants"></a> | ||
### Nested Schema for `broker_tenants` | ||
|
||
Read-Only: | ||
|
||
- `tenant_name` (String) The name of the tenant | ||
|
||
|
||
<a id="nestedatt--server_tenants"></a> | ||
### Nested Schema for `server_tenants` | ||
|
||
Read-Only: | ||
|
||
- `tenant_name` (String) The name of the tenant |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
terraform { | ||
required_providers { | ||
pinot = { | ||
source = "hashicorp.com/edu/pinot" | ||
} | ||
} | ||
} | ||
|
||
provider "pinot" { | ||
controller_url = "http://localhost:9000" | ||
auth_token = "YWRtaW46dmVyeXNlY3JldA" | ||
} | ||
|
||
|
||
data "pinot_clusters" "edu" {} | ||
|
||
|
||
output "edu_clusters" { | ||
value = data.pinot_clusters.edu | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
terraform { | ||
required_providers { | ||
pinot = { | ||
source = "hashicorp.com/edu/pinot" | ||
} | ||
} | ||
} | ||
|
||
provider "pinot" { | ||
controller_url = "http://localhost:9000" | ||
auth_token = "YWRtaW46dmVyeXNlY3JldA" | ||
} | ||
|
||
data "pinot_instances" "test" {} | ||
|
||
output "test_instances" { | ||
value = data.pinot_instances.test | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
provider "pinot" { | ||
# example configuration here | ||
controller_url = "http://localhost:9000" | ||
auth_token = "YWRtaW46dmVyeXNlY3JldA" | ||
controller_url = "http://localhost:9000" //required (can also be set via environment variable PINOT_CONTROLLER_URL) | ||
auth_token = "YWRtaW46dmVyeXNlY3JldA" //optional (can also be set via environment variable PINOT_AUTH_TOKEN) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
terraform { | ||
required_providers { | ||
pinot = { | ||
source = "hashicorp.com/edu/pinot" | ||
} | ||
} | ||
} | ||
|
||
provider "pinot" { | ||
controller_url = "http://localhost:9000" | ||
auth_token = "YWRtaW46dmVyeXNlY3JldA" | ||
} | ||
|
||
|
||
data "pinot_segments" "github" { | ||
table_name = "githubComplexTypeEvents" | ||
} | ||
|
||
data "pinot_segments" "airline" { | ||
table_name = "airlineStats" | ||
} | ||
|
||
output "github_segments" { | ||
value = data.pinot_segments.github | ||
} | ||
|
||
output "airline_segments" { | ||
value = data.pinot_segments.airline | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
terraform { | ||
required_providers { | ||
pinot = { | ||
source = "hashicorp.com/edu/pinot" | ||
} | ||
} | ||
} | ||
|
||
provider "pinot" { | ||
controller_url = "http://localhost:9000" | ||
auth_token = "YWRtaW46dmVyeXNlY3JldA" | ||
} | ||
|
||
|
||
data "pinot_tenants" "edu" {} | ||
|
||
output "edu_tenants" { | ||
value = data.pinot_tenants.edu | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
package provider | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
|
||
goPinotAPI "github.com/azaurus1/go-pinot-api" | ||
"github.com/hashicorp/terraform-plugin-framework/datasource" | ||
"github.com/hashicorp/terraform-plugin-framework/datasource/schema" | ||
) | ||
|
||
// Ensure the implementation satisfies the expected interfaces. | ||
var ( | ||
_ datasource.DataSource = &clustersDataSource{} | ||
_ datasource.DataSourceWithConfigure = &clustersDataSource{} | ||
) | ||
|
||
// NewClustersDataSource is a helper function to simplify the provider implementation. | ||
func NewClustersDataSource() datasource.DataSource { | ||
return &clustersDataSource{} | ||
} | ||
|
||
// clustersDataSource is the data source implementation. | ||
type clustersDataSource struct { | ||
client *goPinotAPI.PinotAPIClient | ||
} | ||
|
||
type clustersDataSourceModel struct { | ||
ClusterName string `tfsdk:"cluster_name"` | ||
ClusterConfig clusterConfigModel `tfsdk:"cluster_config"` | ||
} | ||
|
||
type clusterConfigModel struct { | ||
AllowParticipantAutoJoin string `tfsdk:"allow_participant_auto_join"` | ||
EnableCaseInsensitive string `tfsdk:"enable_case_insensitive"` | ||
DefaultHyperlogLogLog2m string `tfsdk:"default_hyperlog_log_log2m"` | ||
PinotBrokerEnableQueryLimitOverride string `tfsdk:"pinot_broker_enable_query_limit_override"` | ||
} | ||
|
||
// Configure adds the provider configured client to the data source. | ||
func (d *clustersDataSource) Configure(_ context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse) { | ||
if req.ProviderData == nil { | ||
return | ||
} | ||
|
||
client, ok := req.ProviderData.(*goPinotAPI.PinotAPIClient) | ||
if !ok { | ||
resp.Diagnostics.AddError( | ||
"Unexpected Data Source Configure Type", | ||
fmt.Sprintf("Expected *goPinotAPI.PinotAPIClient, got: %T. Please report this issue to the provider developers.", req.ProviderData), | ||
) | ||
|
||
return | ||
} | ||
|
||
d.client = client | ||
} | ||
|
||
// Metadata returns the data source type name. | ||
func (d *clustersDataSource) Metadata(_ context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) { | ||
resp.TypeName = req.ProviderTypeName + "_clusters" | ||
} | ||
|
||
// Schema defines the schema for the data source. | ||
func (d *clustersDataSource) Schema(_ context.Context, _ datasource.SchemaRequest, resp *datasource.SchemaResponse) { | ||
resp.Schema = schema.Schema{ | ||
Attributes: map[string]schema.Attribute{ | ||
"cluster_name": schema.StringAttribute{ | ||
Description: "The name of the Pinot cluster.", | ||
Computed: true, | ||
}, | ||
"cluster_config": schema.SingleNestedAttribute{ | ||
Description: "The configuration of the Pinot cluster.", | ||
Computed: true, | ||
Attributes: map[string]schema.Attribute{ | ||
"allow_participant_auto_join": schema.StringAttribute{ | ||
Computed: true, | ||
}, | ||
"enable_case_insensitive": schema.StringAttribute{ | ||
Computed: true, | ||
}, | ||
"default_hyperlog_log_log2m": schema.StringAttribute{ | ||
Computed: true, | ||
}, | ||
"pinot_broker_enable_query_limit_override": schema.StringAttribute{ | ||
Computed: true, | ||
}, | ||
}, | ||
}, | ||
}, | ||
} | ||
} | ||
|
||
// Read refreshes the Terraform state with the latest data. | ||
func (d *clustersDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { | ||
var state clustersDataSourceModel | ||
|
||
// Get Cluster Name | ||
clusterNameResp, err := d.client.GetClusterInfo() | ||
if err != nil { | ||
resp.Diagnostics.AddError("Failed to get cluster name", err.Error()) | ||
return | ||
} | ||
|
||
state.ClusterName = clusterNameResp.ClusterName | ||
|
||
// Get Cluster Config | ||
clusterConfigResp, err := d.client.GetClusterConfigs() | ||
if err != nil { | ||
resp.Diagnostics.AddError("Failed to get cluster config", err.Error()) | ||
return | ||
} | ||
|
||
state.ClusterConfig.AllowParticipantAutoJoin = clusterConfigResp.AllowParticipantAutoJoin | ||
state.ClusterConfig.EnableCaseInsensitive = clusterConfigResp.EnableCaseInsensitive | ||
state.ClusterConfig.DefaultHyperlogLogLog2m = clusterConfigResp.DefaultHyperlogLogLog2m | ||
state.ClusterConfig.PinotBrokerEnableQueryLimitOverride = clusterConfigResp.PinotBrokerEnableQueryLimitOverride | ||
|
||
diags := resp.State.Set(ctx, &state) | ||
resp.Diagnostics.Append(diags...) | ||
if resp.Diagnostics.HasError() { | ||
return | ||
} | ||
|
||
} |
Oops, something went wrong.