Skip to content

Commit

Permalink
Merge pull request #16277 from hashicorp/f-network-firewall-support
Browse files Browse the repository at this point in the history
r/networkfirewall: new resources
  • Loading branch information
anGie44 authored Nov 18, 2020
2 parents a4bd447 + 7991ed2 commit 74793b2
Show file tree
Hide file tree
Showing 29 changed files with 7,205 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .hashibot.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,9 @@ behavior "regexp_issue_labeler_v2" "service_labels" {
"service/neptune" = [
"aws_neptune_",
],
"service/networkfirewall" = [
"aws_networkfirewall_",
],
"service/networkmanager" = [
"aws_networkmanager_",
],
Expand Down Expand Up @@ -1242,6 +1245,11 @@ behavior "pull_request_path_labeler" "service_labels" {
"**/*_neptune_*",
"**/neptune_*"
]
"service/networkfirewall" = [
"aws/internal/service/networkfirewall/**/*",
"**/*_networkfirewall_*",
"**/networkfirewall_*",
]
"service/networkmanager" = [
"aws/internal/service/networkmanager/**/*",
"**/*_networkmanager_*",
Expand Down
3 changes: 3 additions & 0 deletions aws/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ import (
"github.com/aws/aws-sdk-go/service/mediastoredata"
"github.com/aws/aws-sdk-go/service/mq"
"github.com/aws/aws-sdk-go/service/neptune"
"github.com/aws/aws-sdk-go/service/networkfirewall"
"github.com/aws/aws-sdk-go/service/networkmanager"
"github.com/aws/aws-sdk-go/service/opsworks"
"github.com/aws/aws-sdk-go/service/organizations"
Expand Down Expand Up @@ -302,6 +303,7 @@ type AWSClient struct {
mediastoredataconn *mediastoredata.MediaStoreData
mqconn *mq.MQ
neptuneconn *neptune.Neptune
networkfirewallconn *networkfirewall.NetworkFirewall
networkmanagerconn *networkmanager.NetworkManager
opsworksconn *opsworks.OpsWorks
organizationsconn *organizations.Organizations
Expand Down Expand Up @@ -535,6 +537,7 @@ func (c *Config) Client() (interface{}, error) {
mediastoredataconn: mediastoredata.New(sess.Copy(&aws.Config{Endpoint: aws.String(c.Endpoints["mediastoredata"])})),
mqconn: mq.New(sess.Copy(&aws.Config{Endpoint: aws.String(c.Endpoints["mq"])})),
neptuneconn: neptune.New(sess.Copy(&aws.Config{Endpoint: aws.String(c.Endpoints["neptune"])})),
networkfirewallconn: networkfirewall.New(sess.Copy(&aws.Config{Endpoint: aws.String(c.Endpoints["networkfirewall"])})),
networkmanagerconn: networkmanager.New(sess.Copy(&aws.Config{Endpoint: aws.String(c.Endpoints["networkmanager"])})),
opsworksconn: opsworks.New(sess.Copy(&aws.Config{Endpoint: aws.String(c.Endpoints["opsworks"])})),
organizationsconn: organizations.New(sess.Copy(&aws.Config{Endpoint: aws.String(c.Endpoints["organizations"])})),
Expand Down
1 change: 1 addition & 0 deletions aws/internal/keyvaluetags/generators/listtags/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ var serviceNames = []string{
"mediastore",
"mq",
"neptune",
"networkfirewall",
"networkmanager",
"opsworks",
"organizations",
Expand Down
1 change: 1 addition & 0 deletions aws/internal/keyvaluetags/generators/servicetags/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ var sliceServiceNames = []string{
"lightsail",
"mediastore",
"neptune",
"networkfirewall",
"networkmanager",
"organizations",
"quicksight",
Expand Down
1 change: 1 addition & 0 deletions aws/internal/keyvaluetags/generators/updatetags/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ var serviceNames = []string{
"mediastore",
"mq",
"neptune",
"networkfirewall",
"networkmanager",
"opsworks",
"organizations",
Expand Down
18 changes: 18 additions & 0 deletions aws/internal/keyvaluetags/list_tags_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ import (
"github.com/aws/aws-sdk-go/service/mediastore"
"github.com/aws/aws-sdk-go/service/mq"
"github.com/aws/aws-sdk-go/service/neptune"
"github.com/aws/aws-sdk-go/service/networkfirewall"
"github.com/aws/aws-sdk-go/service/networkmanager"
"github.com/aws/aws-sdk-go/service/opsworks"
"github.com/aws/aws-sdk-go/service/organizations"
Expand Down Expand Up @@ -283,6 +284,8 @@ func ServiceClientType(serviceName string) string {
funcType = reflect.TypeOf(mq.New)
case "neptune":
funcType = reflect.TypeOf(neptune.New)
case "networkfirewall":
funcType = reflect.TypeOf(networkfirewall.New)
case "networkmanager":
funcType = reflect.TypeOf(networkmanager.New)
case "opsworks":
Expand Down
28 changes: 28 additions & 0 deletions aws/internal/keyvaluetags/service_tags_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

37 changes: 37 additions & 0 deletions aws/internal/keyvaluetags/update_tags_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

81 changes: 81 additions & 0 deletions aws/internal/service/networkfirewall/finder/finder.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
package finder

import (
"context"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/networkfirewall"
)

// LoggingConfiguration returns the LoggingConfigurationOutput from a call to DescribeLoggingConfigurationWithContext
// given the context and Firewall ARN.
// Returns nil if the LoggingConfiguration is not found.
func LoggingConfiguration(ctx context.Context, conn *networkfirewall.NetworkFirewall, arn string) (*networkfirewall.DescribeLoggingConfigurationOutput, error) {
input := &networkfirewall.DescribeLoggingConfigurationInput{
FirewallArn: aws.String(arn),
}
output, err := conn.DescribeLoggingConfigurationWithContext(ctx, input)
if err != nil {
return nil, err
}
return output, nil
}

// Firewall returns the FirewallOutput from a call to DescribeFirewallWithContext
// given the context and Firewall ARN.
// Returns nil if the Firewall is not found.
func Firewall(ctx context.Context, conn *networkfirewall.NetworkFirewall, arn string) (*networkfirewall.DescribeFirewallOutput, error) {
input := &networkfirewall.DescribeFirewallInput{
FirewallArn: aws.String(arn),
}
output, err := conn.DescribeFirewallWithContext(ctx, input)
if err != nil {
return nil, err
}
return output, nil
}

// FirewallPolicy returns the FirewallPolicyOutput from a call to DescribeFirewallPolicyWithContext
// given the context and FirewallPolicy ARN.
// Returns nil if the FirewallPolicy is not found.
func FirewallPolicy(ctx context.Context, conn *networkfirewall.NetworkFirewall, arn string) (*networkfirewall.DescribeFirewallPolicyOutput, error) {
input := &networkfirewall.DescribeFirewallPolicyInput{
FirewallPolicyArn: aws.String(arn),
}
output, err := conn.DescribeFirewallPolicyWithContext(ctx, input)
if err != nil {
return nil, err
}
return output, nil
}

// ResourcePolicy returns the Policy string from a call to DescribeResourcePolicyWithContext
// given the context and resource ARN.
// Returns nil if the ResourcePolicy is not found.
func ResourcePolicy(ctx context.Context, conn *networkfirewall.NetworkFirewall, arn string) (*string, error) {
input := &networkfirewall.DescribeResourcePolicyInput{
ResourceArn: aws.String(arn),
}
output, err := conn.DescribeResourcePolicyWithContext(ctx, input)
if err != nil {
return nil, err
}
if output == nil {
return nil, nil
}
return output.Policy, nil
}

// RuleGroup returns the RuleGroupOutput from a call to DescribeRuleGroupWithContext
// given the context and RuleGroup ARN.
// Returns nil if the RuleGroup is not found.
func RuleGroup(ctx context.Context, conn *networkfirewall.NetworkFirewall, arn string) (*networkfirewall.DescribeRuleGroupOutput, error) {
input := &networkfirewall.DescribeRuleGroupInput{
RuleGroupArn: aws.String(arn),
}
output, err := conn.DescribeRuleGroupWithContext(ctx, input)
if err != nil {
return nil, err
}
return output, nil
}
Loading

0 comments on commit 74793b2

Please sign in to comment.