Skip to content

Commit

Permalink
feat: Add prefix query
Browse files Browse the repository at this point in the history
  • Loading branch information
uanid committed Jan 18, 2024
1 parent 0d6801f commit c93e814
Show file tree
Hide file tree
Showing 26 changed files with 85 additions and 57 deletions.
2 changes: 1 addition & 1 deletion docs/data-sources/account.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ description: |-
```terraform
data "bluechip_account" "current" {
metadata {
name = "test2"
name = "test2"
namespace = "default"
}
}
Expand Down
2 changes: 1 addition & 1 deletion docs/data-sources/accounts.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ data "bluechip_accounts" "current" {
Required:

- `field` (String) Field to use for the query term.
- `operator` (String) Operator to use for the query term. One of ['equals', 'notEquals', 'fuzzy', 'wildcard', 'regex', 'matchPhrase'].
- `operator` (String) Operator to use for the query term. One of ['equals', 'notEquals', 'fuzzy', 'wildcard', 'regex', 'matchPhrase', 'prefix'].
- `value` (String) Value to use for the query term.


Expand Down
2 changes: 1 addition & 1 deletion docs/data-sources/cidr.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ description: |-
```terraform
data "bluechip_cidr" "current" {
metadata {
name = "my-test"
name = "my-test"
namespace = "default"
}
}
Expand Down
8 changes: 4 additions & 4 deletions docs/data-sources/cidrs.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ resource "bluechip_cidr" "c1" {
metadata {
name = "cidr1"
namespace = "default"
labels = {
labels = {
"foo" = "bar"
}
annotations = {
Expand All @@ -34,11 +34,11 @@ resource "bluechip_cidr" "c2" {
metadata {
name = "cidr2"
namespace = "default"
labels = {
labels = {
"foo" = "bar"
}
annotations = {
"office" = "true"
"office" = "true"
"bluechip.example.com/location" = "tokyo"
}
}
Expand Down Expand Up @@ -90,7 +90,7 @@ data "bluechip_cidrs" "seoul" {
Required:

- `field` (String) Field to use for the query term.
- `operator` (String) Operator to use for the query term. One of ['equals', 'notEquals', 'fuzzy', 'wildcard', 'regex', 'matchPhrase'].
- `operator` (String) Operator to use for the query term. One of ['equals', 'notEquals', 'fuzzy', 'wildcard', 'regex', 'matchPhrase', 'prefix'].
- `value` (String) Value to use for the query term.


Expand Down
2 changes: 1 addition & 1 deletion docs/data-sources/cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ description: |-
```terraform
data "bluechip_cluster" "current" {
metadata {
name = "test"
name = "test"
namespace = "default"
}
}
Expand Down
2 changes: 1 addition & 1 deletion docs/data-sources/clusterrolebindings.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ data "bluechip_clusterrolebindings" "current" {
Required:

- `field` (String) Field to use for the query term.
- `operator` (String) Operator to use for the query term. One of ['equals', 'notEquals', 'fuzzy', 'wildcard', 'regex', 'matchPhrase'].
- `operator` (String) Operator to use for the query term. One of ['equals', 'notEquals', 'fuzzy', 'wildcard', 'regex', 'matchPhrase', 'prefix'].
- `value` (String) Value to use for the query term.


Expand Down
2 changes: 1 addition & 1 deletion docs/data-sources/clusters.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ data "bluechip_clusters" "current" {
Required:

- `field` (String) Field to use for the query term.
- `operator` (String) Operator to use for the query term. One of ['equals', 'notEquals', 'fuzzy', 'wildcard', 'regex', 'matchPhrase'].
- `operator` (String) Operator to use for the query term. One of ['equals', 'notEquals', 'fuzzy', 'wildcard', 'regex', 'matchPhrase', 'prefix'].
- `value` (String) Value to use for the query term.


Expand Down
2 changes: 1 addition & 1 deletion docs/data-sources/image.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ description: |-
```terraform
data "bluechip_image" "current" {
metadata {
name = "my-test"
name = "my-test"
namespace = "default"
}
}
Expand Down
6 changes: 3 additions & 3 deletions docs/data-sources/images.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ description: |-
data "bluechip_images" "current" {
filter {
operator = "equals"
field = "spec.commitHash"
value = "6874ece755439b5b3473b5b910fb4938751d6689"
field = "spec.commitHash"
value = "6874ece755439b5b3473b5b910fb4938751d6689"
}
namespace = "pubg"
}
Expand Down Expand Up @@ -46,7 +46,7 @@ data "bluechip_images" "current" {
Required:

- `field` (String) Field to use for the query term.
- `operator` (String) Operator to use for the query term. One of ['equals', 'notEquals', 'fuzzy', 'wildcard', 'regex', 'matchPhrase'].
- `operator` (String) Operator to use for the query term. One of ['equals', 'notEquals', 'fuzzy', 'wildcard', 'regex', 'matchPhrase', 'prefix'].
- `value` (String) Value to use for the query term.


Expand Down
2 changes: 1 addition & 1 deletion docs/data-sources/namespaces.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ data "bluechip_namespaces" "current" {
Required:

- `field` (String) Field to use for the query term.
- `operator` (String) Operator to use for the query term. One of ['equals', 'notEquals', 'fuzzy', 'wildcard', 'regex', 'matchPhrase'].
- `operator` (String) Operator to use for the query term. One of ['equals', 'notEquals', 'fuzzy', 'wildcard', 'regex', 'matchPhrase', 'prefix'].
- `value` (String) Value to use for the query term.


Expand Down
1 change: 1 addition & 0 deletions docs/data-sources/oidcauth.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,5 @@ Read-Only:
Read-Only:

- `from` (String)
- `from_path_resolver` (String)
- `to` (String)
3 changes: 2 additions & 1 deletion docs/data-sources/oidcauths.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ data "bluechip_oidcauths" "current" {
Required:

- `field` (String) Field to use for the query term.
- `operator` (String) Operator to use for the query term. One of ['equals', 'notEquals', 'fuzzy', 'wildcard', 'regex', 'matchPhrase'].
- `operator` (String) Operator to use for the query term. One of ['equals', 'notEquals', 'fuzzy', 'wildcard', 'regex', 'matchPhrase', 'prefix'].
- `value` (String) Value to use for the query term.


Expand Down Expand Up @@ -88,4 +88,5 @@ Read-Only:
Read-Only:

- `from` (String)
- `from_path_resolver` (String)
- `to` (String)
2 changes: 1 addition & 1 deletion docs/data-sources/rolebinding.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ description: |-
```terraform
data "bluechip_rolebinding" "current" {
metadata {
name = "my-test"
name = "my-test"
namespace = "default"
}
}
Expand Down
4 changes: 2 additions & 2 deletions docs/data-sources/rolebindings.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ data "bluechip_rolebindings" "current" {
filter {
operator = "equals"
key = "metadata.name"
value = ""
value = ""
}
namespace = "pubg"
}
Expand Down Expand Up @@ -46,7 +46,7 @@ data "bluechip_rolebindings" "current" {
Required:

- `field` (String) Field to use for the query term.
- `operator` (String) Operator to use for the query term. One of ['equals', 'notEquals', 'fuzzy', 'wildcard', 'regex', 'matchPhrase'].
- `operator` (String) Operator to use for the query term. One of ['equals', 'notEquals', 'fuzzy', 'wildcard', 'regex', 'matchPhrase', 'prefix'].
- `value` (String) Value to use for the query term.


Expand Down
2 changes: 1 addition & 1 deletion docs/data-sources/users.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ data "bluechip_users" "current" {
Required:

- `field` (String) Field to use for the query term.
- `operator` (String) Operator to use for the query term. One of ['equals', 'notEquals', 'fuzzy', 'wildcard', 'regex', 'matchPhrase'].
- `operator` (String) Operator to use for the query term. One of ['equals', 'notEquals', 'fuzzy', 'wildcard', 'regex', 'matchPhrase', 'prefix'].
- `value` (String) Value to use for the query term.


Expand Down
2 changes: 1 addition & 1 deletion docs/data-sources/vendors.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ data "bluechip_vendors" "current" {
Required:

- `field` (String) Field to use for the query term.
- `operator` (String) Operator to use for the query term. One of ['equals', 'notEquals', 'fuzzy', 'wildcard', 'regex', 'matchPhrase'].
- `operator` (String) Operator to use for the query term. One of ['equals', 'notEquals', 'fuzzy', 'wildcard', 'regex', 'matchPhrase', 'prefix'].
- `value` (String) Value to use for the query term.


Expand Down
12 changes: 6 additions & 6 deletions docs/resources/account.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@ description: |-
```terraform
resource "bluechip_account" "current" {
metadata {
name = "test2"
name = "test2"
namespace = "default"
}
spec {
account_id = "12398213"
account_id = "12398213"
display_name = "test"
description = "test"
alias = "test"
vendor = "AWS"
regions = ["test"]
description = "test"
alias = "test"
vendor = "AWS"
regions = ["test"]
}
}
```
Expand Down
2 changes: 1 addition & 1 deletion docs/resources/cidr.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ description: |-
```terraform
resource "bluechip_cidr" "current" {
metadata {
name = "my-test"
name = "my-test"
namespace = "default"
}
spec {
Expand Down
22 changes: 11 additions & 11 deletions docs/resources/cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,29 +15,29 @@ description: |-
```terraform
resource "bluechip_cluster" "current" {
metadata {
name = "test"
name = "test"
namespace = "default"
}
spec {
project = "pubg"
environment = "dev"
project = "pubg"
environment = "dev"
organization_unit = "devops"
platform = "pc"
platform = "pc"
pubg {
infra = "common"
site = "devops"
site = "devops"
}
vendor {
name = "AWS"
name = "AWS"
account_id = "12398213"
engine = "EKS"
region = "ap-northeast-2"
engine = "EKS"
region = "ap-northeast-2"
}
kubernetes {
endpoint = "https://api.devops.dev.pubg.com"
ca_cert = "-----BEGIN CERTIFI"
endpoint = "https://api.devops.dev.pubg.com"
ca_cert = "-----BEGIN CERTIFI"
sa_issuer = "https://login.microsoftonline.com/1a27bdbf-e6cc-4e33-85d2-e1c81bad930a/v2.0"
version = "1.28"
version = "1.28"
}
}
}
Expand Down
12 changes: 6 additions & 6 deletions docs/resources/image.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@ description: |-
```terraform
resource "bluechip_image" "current" {
metadata {
name = "my-test"
name = "my-test"
namespace = "default"
}
spec {
app = "my-test"
timestamp = 1398329823
app = "my-test"
timestamp = 1398329823
commit_hash = "1234567890"
repository = "test"
tag = "test"
branch = "test"
repository = "test"
tag = "test"
branch = "test"
}
}
```
Expand Down
36 changes: 30 additions & 6 deletions docs/resources/oidcauth.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,33 @@ resource "bluechip_oidcauth" "current" {
name = "my-test"
}
spec {
username_claim= "sub"
username_prefix= "string"
issuer = "https://accounts.google.com/"
client_id = "string"
username_claim = "sub"
username_prefix = "string"
issuer = "https://accounts.google.com/"
client_id = "string"
required_claims = ["string"]
groups_claim = "string"
groups_prefix = "string"
groups_claim = "string"
groups_prefix = "string"
attribute_mapping {
from = "namespace_path"
from_path_resolver = "bare"
to = "namespace_path"
}
attribute_mapping {
from = "project_path"
from_path_resolver = "bare"
to = "project_path"
}
attribute_mapping {
from = "pipeline_source"
from_path_resolver = "bare"
to = "pipeline_source"
}
attribute_mapping {
from = "ref_path"
from_path_resolver = "bare"
to = "ref_path"
}
}
}
```
Expand Down Expand Up @@ -88,6 +108,10 @@ Required:
- `from` (String)
- `to` (String)

Optional:

- `from_path_resolver` (String)



<a id="nestedblock--timeouts"></a>
Expand Down
2 changes: 1 addition & 1 deletion docs/resources/rolebinding.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ description: |-
```terraform
resource "bluechip_rolebinding" "current" {
metadata {
name = "my-test"
name = "my-test"
namespace = "default"
}
spec {
Expand Down
2 changes: 1 addition & 1 deletion docs/resources/user.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ resource "bluechip_user" "current" {
}
spec {
password = "tetete"
groups = ["asdf"]
groups = ["asdf"]
}
}
```
Expand Down
6 changes: 3 additions & 3 deletions docs/resources/vendor.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ resource "bluechip_vendor" "current" {
}
spec {
display_name = "asdf"
code_name = "AWS"
short_name = "aws"
regions = ["asdf"]
code_name = "AWS"
short_name = "aws"
regions = ["asdf"]
}
}
```
Expand Down
1 change: 1 addition & 0 deletions pkg/bluechip_client/bluechip_models/lists.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const OperatorNotEquals = "notEquals"
const OperatorWildcard = "wildcard"
const OperatorRegex = "regex"
const OperatorMatchPhrase = "matchPhrase"
const OperatorPrefix = "prefix"

type QueryTerm struct {
Operator string `json:"operator"`
Expand Down
3 changes: 2 additions & 1 deletion pkg/framework/fwtype/filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func (FilterType) Schema() *schema.Schema {
},
"operator": {
Type: schema.TypeString,
Description: "Operator to use for the query term. One of ['equals', 'notEquals', 'fuzzy', 'wildcard', 'regex', 'matchPhrase'].",
Description: "Operator to use for the query term. One of ['equals', 'notEquals', 'fuzzy', 'wildcard', 'regex', 'matchPhrase', 'prefix'].",
Required: true,
ValidateFunc: validation.StringInSlice([]string{
bluechip_models.OperatorEquals,
Expand All @@ -39,6 +39,7 @@ func (FilterType) Schema() *schema.Schema {
bluechip_models.OperatorWildcard,
bluechip_models.OperatorRegex,
bluechip_models.OperatorMatchPhrase,
bluechip_models.OperatorPrefix,
}, false),
},
"value": {
Expand Down

0 comments on commit c93e814

Please sign in to comment.