diff --git a/go.mod b/go.mod index b7c4dd4..6bd699f 100644 --- a/go.mod +++ b/go.mod @@ -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 ) diff --git a/go.sum b/go.sum index 7efaf9d..38e53d6 100644 --- a/go.sum +++ b/go.sum @@ -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= diff --git a/plugin/deploy.go b/plugin/deploy.go index e95f1c9..7635837 100644 --- a/plugin/deploy.go +++ b/plugin/deploy.go @@ -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 } @@ -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 @@ -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 = "" @@ -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, diff --git a/plugin/dns.go b/plugin/dns.go index bd59c9a..149158a 100644 --- a/plugin/dns.go +++ b/plugin/dns.go @@ -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 == "" { @@ -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,