Skip to content

Commit

Permalink
update dynamo definition and claim folder structure
Browse files Browse the repository at this point in the history
  • Loading branch information
7navyasa committed Sep 5, 2023
1 parent c1bc09c commit e20c625
Show file tree
Hide file tree
Showing 12 changed files with 230 additions and 230 deletions.
182 changes: 93 additions & 89 deletions compositions/upbound-aws-provider/dynamodb/definition.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,98 +29,102 @@ spec:
spec:
type: object
properties:
attribute: #required for hashKey and/or rangeKey
items:
properties:
name: #name of the hashKey and/or rangeKey
resourceConfig:
properties:
attribute: #required for hashKey and/or rangeKey
items:
properties:
name: #name of the hashKey and/or rangeKey
type: string
type:
enum:
- B #binary
- N #number
- S #string
type: string
required:
- name
- type
type: object
type: array
hashKey:
type: string
rangeKey:
type: string
billingMode:
type: string
default: PAY_PER_REQUEST
readCapacity:
type: number
writeCapacity:
type: number
name:
type: string
providerConfigName:
type: string
default: aws-provider-config
region:
type: string
tags:
additionalProperties:
type: string
type:
enum:
- B #binary
- N #number
- S #string
type: string
required:
- name
- type
type: object
type: array
hashKey:
type: string
rangeKey:
type: string
billingMode:
type: string
default: PAY_PER_REQUEST
readCapacity:
type: number
writeCapacity:
type: number
name:
type: string
providerConfigName:
type: string
default: aws-provider-config
region:
type: string
tags:
additionalProperties:
type: string
description: Key-value map of resource tags.
description: Key-value map of resource tags.
type: object
globalSecondaryIndex:
items:
properties:
hashKey:
type: string
name:
type: string
rangeKey:
type: string
readCapacity:
type: number
writeCapacity:
type: number
projectionType:
type: string
nonKeyAttributes: #required for gsi
items:
type: string
type: array
type: object
required:
- hashKey
- name
- rangeKey
- readCapacity
- writeCapacity
- projectionType
- nonKeyAttributes
type: array
localSecondaryIndex:
items:
properties:
name:
type: string
rangeKey:
type: string
projectionType:
type: string
nonKeyAttributes: #required for lsi
items:
type: string
type: array
type: object
required:
- name
- rangeKey
- projectionType
- nonKeyAttributes
type: array
required:
- hashKey
- attribute
type: object
globalSecondaryIndex:
items:
properties:
hashKey:
type: string
name:
type: string
rangeKey:
type: string
readCapacity:
type: number
writeCapacity:
type: number
projectionType:
type: string
nonKeyAttributes: #required for gsi
items:
type: string
type: array
type: object
required:
- hashKey
- name
- rangeKey
- readCapacity
- writeCapacity
- projectionType
- nonKeyAttributes
type: array
localSecondaryIndex:
items:
properties:
name:
type: string
rangeKey:
type: string
projectionType:
type: string
nonKeyAttributes: #required for gsi
items:
type: string
type: array
type: object
required:
- name
- rangeKey
- projectionType
- nonKeyAttributes
type: array
required:
- region
- hashKey
- attribute
- resourceConfig
status:
type: object
description: TableStatus defines the observed state of Table
Expand Down
33 changes: 12 additions & 21 deletions compositions/upbound-aws-provider/dynamodb/table.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ spec:
- name: common-fields
patches:
- type: FromCompositeFieldPath
fromFieldPath: spec.providerConfigName
fromFieldPath: spec.resourceConfig.providerConfigName
toFieldPath: spec.providerConfigRef.name
- type: FromCompositeFieldPath
fromFieldPath: spec.region
fromFieldPath: spec.resourceConfig.region
toFieldPath: spec.forProvider.region
- type: FromCompositeFieldPath
fromFieldPath: spec.name
fromFieldPath: spec.resourceConfig.name
toFieldPath: metadata.annotations[crossplane.io/external-name]
resources:
- name: table
Expand All @@ -34,9 +34,6 @@ spec:
- type: FromFieldPath
name: tableArn
fromFieldPath: status.atProvider.arn
- type: FromFieldPath
name: region
fromFieldPath: metadata.annotations[crossplane.io/region]
base:
apiVersion: dynamodb.aws.upbound.io/v1beta1
kind: Table
Expand All @@ -48,41 +45,41 @@ spec:
- type: PatchSet
patchSetName: common-fields
- type: FromCompositeFieldPath
fromFieldPath: spec.attribute
fromFieldPath: spec.resourceConfig.attribute
toFieldPath: spec.forProvider.attribute
policy:
mergeOptions:
appendSlice: true
keepMapValues: true
- type: FromCompositeFieldPath
fromFieldPath: spec.tags
fromFieldPath: spec.resourceConfig.tags
toFieldPath: spec.forProvider.tags
policy:
mergeOptions:
keepMapValues: true
- type: FromCompositeFieldPath
fromFieldPath: spec.hashKey
fromFieldPath: spec.resourceConfig.hashKey
toFieldPath: spec.forProvider.hashKey
- type: FromCompositeFieldPath
fromFieldPath: spec.billingMode
fromFieldPath: spec.resourceConfig.billingMode
toFieldPath: spec.forProvider.billingMode
- type: FromCompositeFieldPath
fromFieldPath: spec.rangeKey
fromFieldPath: spec.resourceConfig.rangeKey
toFieldPath: spec.forProvider.rangeKey
- type: FromCompositeFieldPath
fromFieldPath: spec.readCapacity
fromFieldPath: spec.resourceConfig.readCapacity
toFieldPath: spec.forProvider.readCapacity
- type: FromCompositeFieldPath
fromFieldPath: spec.writeCapacity
fromFieldPath: spec.resourceConfig.writeCapacity
toFieldPath: spec.forProvider.writeCapacity
- type: FromCompositeFieldPath
fromFieldPath: spec.globalSecondaryIndex
fromFieldPath: spec.resourceConfig.globalSecondaryIndex
toFieldPath: spec.forProvider.globalSecondaryIndex
policy:
mergeOptions:
keepMapValues: true
- type: FromCompositeFieldPath
fromFieldPath: spec.localSecondaryIndex
fromFieldPath: spec.resourceConfig.localSecondaryIndex
toFieldPath: spec.forProvider.localSecondaryIndex
policy:
mergeOptions:
Expand All @@ -93,9 +90,3 @@ spec:
- type: ToCompositeFieldPath
fromFieldPath: status.atProvider.arn
toFieldPath: status.tableArn
- type: FromCompositeFieldPath
fromFieldPath: spec.region
toFieldPath: metadata.annotations[crossplane.io/region]
- type: ToCompositeFieldPath
fromFieldPath: metadata.annotations[crossplane.io/region]
toFieldPath: status.region
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: awsblueprints.io/v1alpha1
kind: DynamoDBTable
metadata:
name: test-dynamodb-table
namespace: default
spec:
writeConnectionSecretToRef:
name: dynamo2
resourceConfig:
attribute:
- name: UserId
type: S
hashKey: UserId
region: us-west-2
tags:
namespace: team-x
cluster: crossplane
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
apiVersion: awsblueprints.io/v1alpha1
kind: DynamoDBTable
metadata:
name: test-gsi-dynamodb-table
namespace: default
spec:
writeConnectionSecretToRef:
name: dynamogsi
resourceConfig:
attribute:
- name: UserId
type: S
- name: UserName
type: S
- name: Pass
type: B
billingMode: PROVISIONED
globalSecondaryIndex:
- hashKey: UserName
name: UserNameIndex
nonKeyAttributes:
- UserId
projectionType: INCLUDE
rangeKey: Pass
readCapacity: 10
writeCapacity: 10
readCapacity: 20
writeCapacity: 20
hashKey: UserId
rangeKey: UserName
region: us-west-2
tags:
namespace: team-x
cluster: crossplane
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
apiVersion: awsblueprints.io/v1alpha1
kind: DynamoDBTable
metadata:
name: test-lsi2-dynamodb-table
namespace: default
spec:
writeConnectionSecretToRef:
name: dynamolsi
resourceConfig:
attribute:
- name: Artist
type: S
- name: SongTitle
type: S
- name: AlbumTitle
type: S
billingMode: PROVISIONED
localSecondaryIndex:
- name: AlbumTitleIndex
nonKeyAttributes:
- Genre
projectionType: INCLUDE
rangeKey: AlbumTitle
readCapacity: 20
writeCapacity: 20
hashKey: Artist
rangeKey: SongTitle
region: us-west-2
tags:
namespace: team-x
cluster: crossplane
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
apiVersion: awsblueprints.io/v1alpha1
kind: DynamoDBTable
metadata:
name: test-pro-dynamodb-table
namespace: default
spec:
writeConnectionSecretToRef:
name: dynamopc
resourceConfig:
attribute:
- name: UserId
type: S
- name: UserName
type: S
billingMode: PROVISIONED
readCapacity: 2
writeCapacity: 2
hashKey: UserId
rangeKey: UserName
region: us-west-2
tags:
namespace: team-x
cluster: crossplane
Loading

0 comments on commit e20c625

Please sign in to comment.