-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MEDIUM: api consolidation - Move child resources as nested resources
- Loading branch information
1 parent
42c82e2
commit 169188f
Showing
38 changed files
with
23,981 additions
and
22,141 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
extends: default | ||
|
||
ignore: | | ||
build/ | ||
specification/haproxy-spec.yaml | ||
.github/ | ||
rules: | ||
|
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,46 @@ | ||
// Copyright 2019 HAProxy Technologies | ||
// | ||
// 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 parents | ||
|
||
const ( | ||
ServerChildType = "server" | ||
HTTPAfterResponseRuleChildType = "http_after_response_rule" | ||
HTTPCheckChildType = "http_check" | ||
HTTPErrorRuleChildType = "http_error_rule" | ||
HTTPRequestRuleChildType = "http_request_rule" | ||
HTTPResponseRuleChildType = "http_response_rule" | ||
TCPCheckChildType = "tcp_check" | ||
TCPRequestRuleChildType = "tcp_request_rule" | ||
TCPResponseRuleChildType = "tcp_response_rule" | ||
ACLChildType = "acl" | ||
BindChildType = "bind" | ||
FilterChildType = "filter" | ||
LogTargetChildType = "log_target" | ||
) | ||
|
||
type CnParentType string | ||
|
||
const ( | ||
BackendParentType CnParentType = "backend" | ||
FrontendParentType CnParentType = "frontend" | ||
DefaultsParentType CnParentType = "defaults" | ||
LogForwardParentType CnParentType = "log_forward" | ||
PeerParentType CnParentType = "peers" | ||
RingParentType CnParentType = "ring" | ||
GlobalParentType CnParentType = "global" | ||
FCGIAppParentType CnParentType = "fcgi-app" | ||
ResolverParentType CnParentType = "resolvers" | ||
) |
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,101 @@ | ||
// Copyright 2019 HAProxy Technologies | ||
// | ||
// 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 parents | ||
|
||
type Parent struct { | ||
PathParentType string | ||
ParentType string | ||
IsGenericParent bool // only one of the parents for a child type can be set as Geenric - used in Dapi | ||
GenericParentType string | ||
IsUnnamedParent bool | ||
} | ||
|
||
func Parents(childType string) []Parent { | ||
switch childType { | ||
case ServerChildType: | ||
return []Parent{ | ||
{PathParentType: "backends", ParentType: "Backend", IsGenericParent: true}, | ||
{PathParentType: "peers", ParentType: "Peer", GenericParentType: "Backend"}, | ||
{PathParentType: "rings", ParentType: "Ring", GenericParentType: "Backend"}, | ||
} | ||
case HTTPAfterResponseRuleChildType: | ||
return []Parent{ | ||
{PathParentType: "backends", ParentType: "Backend", IsGenericParent: true}, | ||
{PathParentType: "frontends", ParentType: "Frontend", GenericParentType: "Backend"}, | ||
} | ||
case HTTPCheckChildType: | ||
return []Parent{ | ||
{PathParentType: "backends", ParentType: "Backend", IsGenericParent: true}, | ||
{PathParentType: "defaults", ParentType: "Defaults", GenericParentType: "Backend"}, | ||
} | ||
case HTTPErrorRuleChildType: | ||
return []Parent{ | ||
{PathParentType: "backends", ParentType: "Backend", IsGenericParent: true}, | ||
{PathParentType: "frontends", ParentType: "Frontend", GenericParentType: "Backend"}, | ||
{PathParentType: "defaults", ParentType: "Defaults", GenericParentType: "Backend"}, | ||
} | ||
case HTTPRequestRuleChildType: | ||
return []Parent{ | ||
{PathParentType: "backends", ParentType: "Backend", IsGenericParent: true}, | ||
{PathParentType: "frontends", ParentType: "Frontend", GenericParentType: "Backend"}, | ||
} | ||
case HTTPResponseRuleChildType: | ||
return []Parent{ | ||
{PathParentType: "backends", ParentType: "Backend", IsGenericParent: true}, | ||
{PathParentType: "frontends", ParentType: "Frontend", GenericParentType: "Backend"}, | ||
} | ||
case TCPCheckChildType: | ||
return []Parent{ | ||
{PathParentType: "backends", ParentType: "Backend", IsGenericParent: true}, | ||
{PathParentType: "defaults", ParentType: "Defaults", GenericParentType: "Backend"}, | ||
} | ||
case TCPRequestRuleChildType: | ||
return []Parent{ | ||
{PathParentType: "backends", ParentType: "Backend", IsGenericParent: true}, | ||
{PathParentType: "frontends", ParentType: "Frontend", GenericParentType: "Backend"}, | ||
} | ||
case TCPResponseRuleChildType: | ||
return []Parent{ | ||
{PathParentType: "backends", ParentType: "Backend", IsGenericParent: true}, | ||
} | ||
case ACLChildType: | ||
return []Parent{ | ||
{PathParentType: "backends", ParentType: "Backend", IsGenericParent: true}, | ||
{PathParentType: "frontends", ParentType: "Frontend", GenericParentType: "Backend"}, | ||
{PathParentType: "fcgi_apps", ParentType: "FCGIApp", GenericParentType: "Backend"}, | ||
} | ||
case BindChildType: | ||
return []Parent{ | ||
{PathParentType: "frontends", ParentType: "Frontend", IsGenericParent: true}, | ||
{PathParentType: "log_forwards", ParentType: "LogForward", GenericParentType: "Frontend"}, | ||
{PathParentType: "peers", ParentType: "Peer", GenericParentType: "Frontend"}, | ||
} | ||
case FilterChildType: | ||
return []Parent{ | ||
{PathParentType: "backends", ParentType: "Backend", IsGenericParent: true}, | ||
{PathParentType: "frontends", ParentType: "Frontend", GenericParentType: "Backend"}, | ||
} | ||
case LogTargetChildType: | ||
return []Parent{ | ||
{PathParentType: "backends", ParentType: "Backend", IsGenericParent: true}, | ||
{PathParentType: "frontends", ParentType: "Frontend", GenericParentType: "Backend"}, | ||
{PathParentType: "defaults", ParentType: "Defaults", GenericParentType: "Backend"}, | ||
{PathParentType: "peers", ParentType: "Peer", GenericParentType: "Backend"}, | ||
{PathParentType: "log_forwards", ParentType: "LogForward", GenericParentType: "Backend"}, | ||
} | ||
} | ||
return nil | ||
} |
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
Oops, something went wrong.