Documentation ¶
Overview ¶
Copyright 2023 The Radius 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.
Copyright 2023 The Radius 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.
Copyright 2023 The Radius 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.
Copyright 2023 The Radius 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.
Copyright 2023 The Radius 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.
Copyright 2023 The Radius 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.
Copyright 2023 The Radius 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.
Copyright 2023 The Radius 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.
Copyright 2023 The Radius 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.
Copyright 2023 The Radius 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.
Index ¶
- Constants
- func CloudControlRegionOption(region string) func(*cloudcontrol.Options)
- func CloudFormationWithRegionOption(region string) func(*cloudformation.Options)
- func NewCreateOrUpdateAWSResource(opts armrpc_controller.Options, awsClients ucp_aws.Clients) (armrpc_controller.Controller, error)
- func NewCreateOrUpdateAWSResourceWithPost(opts armrpc_controller.Options, awsClients ucp_aws.Clients) (armrpc_controller.Controller, error)
- func NewDeleteAWSResource(opts armrpc_controller.Options, awsClients ucp_aws.Clients) (armrpc_controller.Controller, error)
- func NewDeleteAWSResourceWithPost(opts armrpc_controller.Options, awsClients ucp_aws.Clients) (armrpc_controller.Controller, error)
- func NewGetAWSOperationResults(opts armrpc_controller.Options, awsClients ucp_aws.Clients) (armrpc_controller.Controller, error)
- func NewGetAWSOperationStatuses(opts armrpc_controller.Options, awsClients ucp_aws.Clients) (armrpc_controller.Controller, error)
- func NewGetAWSResource(opts armrpc_controller.Options, awsClients ucp_aws.Clients) (armrpc_controller.Controller, error)
- func NewGetAWSResourceWithPost(opts armrpc_controller.Options, awsClients ucp_aws.Clients) (armrpc_controller.Controller, error)
- func NewListAWSResources(opts armrpc_controller.Options, awsClients ucp_aws.Clients) (armrpc_controller.Controller, error)
- type AWSTestResource
- func CreateAWSTestResource(resourceType, awsResourceType, resourceName, provider, arn string, ...) *AWSTestResource
- func CreateAWSTestResourceWithInvalidRegion(resourceType, awsResourceType, resourceName, provider, arn string, ...) *AWSTestResource
- func CreateKinesisStreamTestResource(resourceName string) *AWSTestResource
- func CreateKinesisStreamTestResourceWithInvalidRegion(resourceName string) *AWSTestResource
- func CreateMemoryDBClusterTestResource(resourceName string) *AWSTestResource
- func CreateRedshiftEndpointAuthorizationTestResource(resourceName string) *AWSTestResource
- type CreateOrUpdateAWSResource
- type CreateOrUpdateAWSResourceWithPost
- type DeleteAWSResource
- type DeleteAWSResourceWithPost
- type GetAWSOperationResults
- type GetAWSOperationStatuses
- type GetAWSResource
- type GetAWSResourceWithPost
- type ListAWSResources
- type TestOptions
Constants ¶
const ( AWSKinesisStreamResourceType = "AWS.Kinesis/Stream" AWSKinesisStreamAWSResourceType = "AWS::Kinesis::Stream" AWSMemoryDBClusterResourceType = "AWS.MemoryDB/Cluster" AWSMemoryDBClusterAWSResourceType = "AWS::MemoryDB::Cluster" AWSRedShiftEndpointAuthorizationResourceType = "AWS.RedShift/EndpointAuthorization" AWSRedShiftEndpointAuthorizationAWSResourceType = "AWS::RedShift::EndpointAuthorization" )
Variables ¶
This section is empty.
Functions ¶
func CloudControlRegionOption ¶
func CloudControlRegionOption(region string) func(*cloudcontrol.Options)
CloudControlRegionOption sets the region for the CloudControl client.
func CloudFormationWithRegionOption ¶
func CloudFormationWithRegionOption(region string) func(*cloudformation.Options)
CloudFormationRegionOption sets the region for the CloudFormation client.
func NewCreateOrUpdateAWSResource ¶
func NewCreateOrUpdateAWSResource(opts armrpc_controller.Options, awsClients ucp_aws.Clients) (armrpc_controller.Controller, error)
NewCreateOrUpdateAWSResource creates a new CreateOrUpdateAWSResource.
func NewCreateOrUpdateAWSResourceWithPost ¶
func NewCreateOrUpdateAWSResourceWithPost(opts armrpc_controller.Options, awsClients ucp_aws.Clients) (armrpc_controller.Controller, error)
NewCreateOrUpdateAWSResourceWithPost creates a new CreateOrUpdateAWSResourceWithPost.
func NewDeleteAWSResource ¶
func NewDeleteAWSResource(opts armrpc_controller.Options, awsClients ucp_aws.Clients) (armrpc_controller.Controller, error)
NewDeleteAWSResource creates a new DeleteAWSResource controller which is used to delete AWS resources and returns it along with a nil error.
func NewDeleteAWSResourceWithPost ¶
func NewDeleteAWSResourceWithPost(opts armrpc_controller.Options, awsClients ucp_aws.Clients) (armrpc_controller.Controller, error)
NewDeleteAWSResourceWithPost creates a new DeleteAWSResourceWithPost controller which is used to delete an AWS resource using a POST request.
func NewGetAWSOperationResults ¶
func NewGetAWSOperationResults(opts armrpc_controller.Options, awsClients ucp_aws.Clients) (armrpc_controller.Controller, error)
NewGetAWSOperationResults creates a new GetAWSOperationResults controller with the given options and AWS clients, and returns it without an error.
func NewGetAWSOperationStatuses ¶
func NewGetAWSOperationStatuses(opts armrpc_controller.Options, awsClients ucp_aws.Clients) (armrpc_controller.Controller, error)
NewGetAWSOperationStatuses creates a new GetAWSOperationStatuses controller which is used to get the statuses of AWS operations.
func NewGetAWSResource ¶
func NewGetAWSResource(opts armrpc_controller.Options, awsClients ucp_aws.Clients) (armrpc_controller.Controller, error)
NewGetAWSResource creates a new GetAWSResource controller with the given options and AWS clients, and returns it or an error if one occurs.
func NewGetAWSResourceWithPost ¶
func NewGetAWSResourceWithPost(opts armrpc_controller.Options, awsClients ucp_aws.Clients) (armrpc_controller.Controller, error)
NewGetAWSResourceWithPost creates a new GetAWSResourceWithPost controller with the given options and AWS clients.
func NewListAWSResources ¶
func NewListAWSResources(opts armrpc_controller.Options, awsClients ucp_aws.Clients) (armrpc_controller.Controller, error)
NewListAWSResources creates a new ListAWSResources controller with the given options and AWS clients.
Types ¶
type AWSTestResource ¶
type AWSTestResource struct { ResourceType string AWSResourceType string ResourceName string ARN string CollectionPath string SingleResourcePath string OperationResultsPath string OperationStatusesPath string LocationHeader string AzureAsyncOpHeader string Schema string }
func CreateAWSTestResource ¶
func CreateAWSTestResource(resourceType, awsResourceType, resourceName, provider, arn string, typeSchema map[string]any) *AWSTestResource
CreateAWSTestResource creates an AWSTestResource object with the given parameters and returns it. If an error occurs while marshalling the typeSchema, it returns nil.
func CreateAWSTestResourceWithInvalidRegion ¶
func CreateAWSTestResourceWithInvalidRegion(resourceType, awsResourceType, resourceName, provider, arn string, typeSchema map[string]any) *AWSTestResource
CreateAWSTestResourceWithInvalidRegion creates an AWSTestResource object with invalid region information and returns it. It returns nil if an error occurs while marshalling the typeSchema.
func CreateKinesisStreamTestResource ¶
func CreateKinesisStreamTestResource(resourceName string) *AWSTestResource
CreateKinesisStreamTestResource creates a test resource of type AWSKinesisStreamResourceType with the given resourceName, provider, arn and typeSchema.
func CreateKinesisStreamTestResourceWithInvalidRegion ¶
func CreateKinesisStreamTestResourceWithInvalidRegion(resourceName string) *AWSTestResource
CreateKinesisStreamTestResourceWithInvalidRegion creates a test resource with an invalid region for testing purposes.
func CreateMemoryDBClusterTestResource ¶
func CreateMemoryDBClusterTestResource(resourceName string) *AWSTestResource
CreateMemoryDBClusterTestResource creates a test resource of type AWSMemoryDBClusterResourceType with the given resourceName, provider, arn, and typeSchema.
func CreateRedshiftEndpointAuthorizationTestResource ¶
func CreateRedshiftEndpointAuthorizationTestResource(resourceName string) *AWSTestResource
CreateRedshiftEndpointAuthorizationTestResource creates a test resource for a Redshift Endpoint Authorization with the given resource name and returns a pointer to the AWSTestResource.
type CreateOrUpdateAWSResource ¶
type CreateOrUpdateAWSResource struct { armrpc_controller.Operation[*datamodel.AWSResource, datamodel.AWSResource] // contains filtered or unexported fields }
CreateOrUpdateAWSResource is the controller implementation to create/update an AWS resource.
func (*CreateOrUpdateAWSResource) Run ¶
func (p *CreateOrUpdateAWSResource) Run(ctx context.Context, w http.ResponseWriter, req *http.Request) (armrpc_rest.Response, error)
"Run" reads the request body, determines if the resource exists, and either creates or updates the resource accordingly, returning an async operation response with the resource's properties and a request token.
type CreateOrUpdateAWSResourceWithPost ¶
type CreateOrUpdateAWSResourceWithPost struct { armrpc_controller.Operation[*datamodel.AWSResource, datamodel.AWSResource] // contains filtered or unexported fields }
CreateOrUpdateAWSResourceWithPost is the controller implementation to create/update an AWS resource.
func (*CreateOrUpdateAWSResourceWithPost) Run ¶
func (p *CreateOrUpdateAWSResourceWithPost) Run(ctx context.Context, w http.ResponseWriter, req *http.Request) (armrpc_rest.Response, error)
"Run" reads the request body to get properties, checks if the resource exists, and creates or updates the resource accordingly, returning an async operation response.
type DeleteAWSResource ¶
type DeleteAWSResource struct { armrpc_controller.Operation[*datamodel.AWSResource, datamodel.AWSResource] // contains filtered or unexported fields }
DeleteAWSResource is the controller implementation to delete AWS resource.
func (*DeleteAWSResource) Run ¶
func (p *DeleteAWSResource) Run(ctx context.Context, w http.ResponseWriter, req *http.Request) (armrpc_rest.Response, error)
Run() parses the request to get the region, then calls the CloudControl API to delete the resource, and returns an AsyncOperationResponse with the operation ID if successful, or an error if not.
type DeleteAWSResourceWithPost ¶
type DeleteAWSResourceWithPost struct { armrpc_controller.Operation[*datamodel.AWSResource, datamodel.AWSResource] // contains filtered or unexported fields }
DeleteAWSResourceWithPost is the controller implementation to delete an AWS resource.
func (*DeleteAWSResourceWithPost) Run ¶
func (p *DeleteAWSResourceWithPost) Run(ctx context.Context, w http.ResponseWriter, req *http.Request) (armrpc_rest.Response, error)
Run() reads the region from the request, reads properties from the body, gets the primary identifier from the properties, logs the resource to be deleted, deletes the resource, and returns an async operation response. If the resource is not found, it returns a no content response. If an error occurs, it returns an error response.
type GetAWSOperationResults ¶
type GetAWSOperationResults struct { armrpc_controller.Operation[*datamodel.AWSResource, datamodel.AWSResource] // contains filtered or unexported fields }
GetAWSOperationResults is the controller implementation to get AWS resource operation results.
func (*GetAWSOperationResults) Run ¶
func (p *GetAWSOperationResults) Run(ctx context.Context, w http.ResponseWriter, req *http.Request) (armrpc_rest.Response, error)
Run reads the region from the request, calls the AWS CloudControl API to get the resource request status, checks if the status is terminal, and returns an AsyncOperationResultResponse if the status is not terminal, or a NoContentResponse if the status is terminal. An error is returned if the AWS resource is not found or if there is an AWS error.
type GetAWSOperationStatuses ¶
type GetAWSOperationStatuses struct { armrpc_controller.Operation[*datamodel.AWSResource, datamodel.AWSResource] // contains filtered or unexported fields }
GetAWSOperationStatuses is the controller implementation to get AWS resource operation status.
func (*GetAWSOperationStatuses) Run ¶
func (p *GetAWSOperationStatuses) Run(ctx context.Context, w http.ResponseWriter, req *http.Request) (armrpc_rest.Response, error)
Run() reads the region from the request, uses the region to get the resource request status from AWS CloudControl, and returns the async operation status. If the resource is not found, it returns a NotFoundResponse, and if there is an error, it returns an error response.
type GetAWSResource ¶
type GetAWSResource struct { armrpc_controller.Operation[*datamodel.AWSResource, datamodel.AWSResource] // contains filtered or unexported fields }
GetAWSResource is the controller implementation to get AWS resource.
func (*GetAWSResource) Run ¶
func (p *GetAWSResource) Run(ctx context.Context, w http.ResponseWriter, req *http.Request) (armrpc_rest.Response, error)
Run() reads the region from the request, gets the resource from AWS using the region and resource type and ID, and returns a response containing the resource's properties.
type GetAWSResourceWithPost ¶
type GetAWSResourceWithPost struct { armrpc_controller.Operation[*datamodel.AWSResource, datamodel.AWSResource] // contains filtered or unexported fields }
GetAWSResourceWithPost is the controller implementation to get an AWS resource.
func (*GetAWSResourceWithPost) Run ¶
func (p *GetAWSResourceWithPost) Run(ctx context.Context, w http.ResponseWriter, req *http.Request) (armrpc_rest.Response, error)
Run() reads the region from the request, reads properties from the body, fetches the resource from AWS, computes the resource ID and returns an OK response with the resource details. If the resource is not found, it returns a NotFound response. If any other error occurs, it returns an error response.
type ListAWSResources ¶
type ListAWSResources struct { armrpc_controller.Operation[*datamodel.AWSResource, datamodel.AWSResource] // contains filtered or unexported fields }
ListAWSResources is the controller implementation to get/list AWS resources.
func (*ListAWSResources) Run ¶
func (p *ListAWSResources) Run(ctx context.Context, w http.ResponseWriter, req *http.Request) (armrpc_rest.Response, error)
Run() reads the region from the request, uses the AWS resource type from the context, and lists the resources in the region, returning a response with the list of resources.
type TestOptions ¶
type TestOptions struct { AWSCloudControlClient *awsclient.MockAWSCloudControlClient AWSCloudFormationClient *awsclient.MockAWSCloudFormationClient StorageClient *store.MockStorageClient }