-
Notifications
You must be signed in to change notification settings - Fork 364
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: haarchri <chhaar30@googlemail.com>
- Loading branch information
Showing
19 changed files
with
2,275 additions
and
1 deletion.
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
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,71 @@ | ||
/* | ||
Copyright 2021 The Crossplane Authors. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package v1alpha1 | ||
|
||
import ( | ||
xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" | ||
) | ||
|
||
// CustomStreamParameters contains the additional fields for StreamParameters. | ||
type CustomStreamParameters struct { | ||
// The retention period of the stream, in hours. | ||
// Default: 24 hours | ||
RetentionPeriodHours *int64 `json:"retentionPeriodHours,omitempty"` | ||
|
||
KMSKeyARN *string `json:"kmsKeyARN,omitempty"` | ||
|
||
KMSKeyARNRef *xpv1.Reference `json:"kmsKeyARNRef,omitempty"` | ||
|
||
KMSKeyARNSelector *xpv1.Selector `json:"kmsKeyARNSelector,omitempty"` | ||
|
||
// List of shard-level metrics. | ||
// | ||
// The following are the valid shard-level metrics. The value "ALL" enhances | ||
// every metric. | ||
// | ||
// * IncomingBytes | ||
// | ||
// * IncomingRecords | ||
// | ||
// * OutgoingBytes | ||
// | ||
// * OutgoingRecords | ||
// | ||
// * WriteProvisionedThroughputExceeded | ||
// | ||
// * ReadProvisionedThroughputExceeded | ||
// | ||
// * IteratorAgeMilliseconds | ||
// | ||
// * ALL | ||
// | ||
// For more information, see Monitoring the Amazon Kinesis Data Streams Service | ||
// with Amazon CloudWatch (https://docs.aws.amazon.com/kinesis/latest/dev/monitoring-with-cloudwatch.html) | ||
// in the Amazon Kinesis Data Streams Developer Guide. | ||
EnhancedMetrics []*EnhancedMetrics `json:"enhancedMetrics,omitempty"` | ||
|
||
Tags []CustomTag `json:"tags,omitempty"` | ||
} | ||
|
||
// CustomTag contains the additional fields for Tag. | ||
type CustomTag struct { | ||
// A unique identifier for the tag. | ||
Key string `json:"key"` | ||
|
||
// An optional string, typically used to describe or define the tag. | ||
Value string `json:"value,omitempty"` | ||
} |
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,9 @@ | ||
ignore: | ||
field_paths: | ||
- CreateStreamInput.StreamName | ||
resources: | ||
Stream: | ||
exceptions: | ||
errors: | ||
404: | ||
code: ResourceNotFoundException |
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,63 @@ | ||
/* | ||
Copyright 2021 The Crossplane Authors. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package v1alpha1 | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/pkg/errors" | ||
"sigs.k8s.io/controller-runtime/pkg/client" | ||
|
||
"github.com/crossplane/crossplane-runtime/pkg/reference" | ||
resource "github.com/crossplane/crossplane-runtime/pkg/resource" | ||
|
||
kms "github.com/crossplane/provider-aws/apis/kms/v1alpha1" | ||
) | ||
|
||
// ResolveReferences of this Stream | ||
func (mg *Stream) ResolveReferences(ctx context.Context, c client.Reader) error { | ||
r := reference.NewAPIResolver(c, mg) | ||
|
||
// Resolve spec.forProvider.kmsKeyARN | ||
rsp, err := r.Resolve(ctx, reference.ResolutionRequest{ | ||
CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KMSKeyARN), | ||
Reference: mg.Spec.ForProvider.KMSKeyARNRef, | ||
Selector: mg.Spec.ForProvider.KMSKeyARNSelector, | ||
To: reference.To{Managed: &kms.Key{}, List: &kms.KeyList{}}, | ||
Extract: KMSKeyARN(), | ||
}) | ||
if err != nil { | ||
return errors.Wrap(err, "spec.forProvider.kmsKeyARN") | ||
} | ||
mg.Spec.ForProvider.KMSKeyARN = reference.ToPtrValue(rsp.ResolvedValue) | ||
mg.Spec.ForProvider.KMSKeyARNRef = rsp.ResolvedReference | ||
return nil | ||
} | ||
|
||
// KMSKeyARN returns the status.atProvider.ARN of an KMSKey. | ||
func KMSKeyARN() reference.ExtractValueFn { | ||
return func(mg resource.Managed) string { | ||
r, ok := mg.(*kms.Key) | ||
if !ok { | ||
return "" | ||
} | ||
if r.Status.AtProvider.ARN == nil { | ||
return "" | ||
} | ||
return *r.Status.AtProvider.ARN | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.