Skip to content

Commit

Permalink
alpha: sdk updates
Browse files Browse the repository at this point in the history
  • Loading branch information
23doors committed Aug 3, 2022
1 parent 0d47aca commit 35ce2ef
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.18

require (
github.com/cloudflare/cloudflare-go v0.40.0
github.com/outblocks/outblocks-plugin-go v0.0.0-20220712161354-7d8111dfc469
github.com/outblocks/outblocks-plugin-go v0.0.0-20220803192450-7744c1c50028
google.golang.org/protobuf v1.28.0
)

Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+
github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw=
github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
github.com/outblocks/outblocks-plugin-go v0.0.0-20220712161354-7d8111dfc469 h1:KviouI7jaoEij8qlvLlKf6EMcUwCWWrwtQ7kqFo+OnY=
github.com/outblocks/outblocks-plugin-go v0.0.0-20220712161354-7d8111dfc469/go.mod h1:Wnb50otE4YCKHxyxpnJi1G3iYVW5pnTAeLHpo3Mu0Lk=
github.com/outblocks/outblocks-plugin-go v0.0.0-20220803192450-7744c1c50028 h1:PjHUEGVTudKUesESpBm9ukAIwvMYvTZTsOpBOQqITGI=
github.com/outblocks/outblocks-plugin-go v0.0.0-20220803192450-7744c1c50028/go.mod h1:Wnb50otE4YCKHxyxpnJi1G3iYVW5pnTAeLHpo3Mu0Lk=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
Expand Down
16 changes: 8 additions & 8 deletions plugin/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func (p *Plugin) validCloudflareDomains(domains []*apiv1.DomainInfo) []*apiv1.Do
continue
}

if domainInfo.Other.AsMap()["cloudflare_proxy"] != true && domainInfo.Cert != "" && domainInfo.Key != "" {
if domainInfo.Properties.AsMap()["cloudflare_proxy"] != true && domainInfo.Cert != "" && domainInfo.Key != "" {
continue
}

Expand Down Expand Up @@ -130,12 +130,12 @@ func (p *Plugin) registerOriginCertificates(reg *registry.Registry, domains []*a
d.Cert = pendingValue
d.Key = pendingValue

if d.Other.GetFields() == nil {
d.Other, _ = structpb.NewStruct(nil)
if d.Properties.GetFields() == nil {
d.Properties, _ = structpb.NewStruct(nil)
}

d.Other.Fields["cloudflare_proxy"] = structpb.NewBoolValue(true)
d.Other.Fields["cloudflare_origin"] = structpb.NewBoolValue(true)
d.Properties.Fields["cloudflare_proxy"] = structpb.NewBoolValue(true)
d.Properties.Fields["cloudflare_origin"] = structpb.NewBoolValue(true)
}

return nil
Expand All @@ -150,11 +150,11 @@ func (p *Plugin) processOriginCertificates() {
}

for _, domain := range p.nonOriginDomains {
if domain.Other.AsMap()["cloudflare_origin"] != true {
if domain.Properties.AsMap()["cloudflare_origin"] != true {
continue
}

delete(domain.Other.GetFields(), "cloudflare_origin")
delete(domain.Properties.GetFields(), "cloudflare_origin")

domain.Cert = ""
domain.Key = ""
Expand Down Expand Up @@ -208,7 +208,7 @@ func (p *Plugin) Plan(ctx context.Context, reg *registry.Registry, r *apiv1.Plan
r.State.Registry = data

return &apiv1.PlanResponse{
Deploy: &apiv1.Plan{
Plan: &apiv1.Plan{
Actions: registry.PlanActionFromDiff(diff),
},
State: r.State,
Expand Down
4 changes: 2 additions & 2 deletions plugin/dns.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func (p *Plugin) registerDNSRecords(reg *registry.Registry, domains []*apiv1.Dom

for _, rec := range records {
di := matcher.Match(rec.Record)
proxy := di != nil && di.Other.AsMap()["cloudflare_proxy"] == true && strings.Count(rec.Record, ".") <= 2
proxy := di != nil && di.Properties.AsMap()["cloudflare_proxy"] == true && strings.Count(rec.Record, ".") <= 2

zone := p.getDomainZoneName(rec.Record)
if zone == "" {
Expand Down Expand Up @@ -97,7 +97,7 @@ func (p *Plugin) PlanDNS(ctx context.Context, reg *registry.Registry, r *apiv1.P
r.State.Registry = data

return &apiv1.PlanDNSResponse{
Dns: &apiv1.Plan{
Plan: &apiv1.Plan{
Actions: registry.PlanActionFromDiff(diff),
},
State: state,
Expand Down

0 comments on commit 35ce2ef

Please sign in to comment.