diff --git a/applications/application.go b/application/application.go similarity index 98% rename from applications/application.go rename to application/application.go index 35c4caeb..ee6b6c7e 100644 --- a/applications/application.go +++ b/application/application.go @@ -1,4 +1,4 @@ -package applications +package application import "database/sql" diff --git a/applications/datastore.go b/application/datastore.go similarity index 99% rename from applications/datastore.go rename to application/datastore.go index 24b65551..697480e2 100644 --- a/applications/datastore.go +++ b/application/datastore.go @@ -1,4 +1,4 @@ -package applications +package application import ( "fmt" diff --git a/applications/datastore_test.go b/application/datastore_test.go similarity index 98% rename from applications/datastore_test.go rename to application/datastore_test.go index e7c18a55..2e00493d 100644 --- a/applications/datastore_test.go +++ b/application/datastore_test.go @@ -1,4 +1,4 @@ -package applications +package application import ( "database/sql" diff --git a/applications/statement.go b/application/statement.go similarity index 99% rename from applications/statement.go rename to application/statement.go index d0d8e631..3b32efba 100644 --- a/applications/statement.go +++ b/application/statement.go @@ -1,4 +1,4 @@ -package applications +package application import ( "fmt" diff --git a/certificates/certificate.go b/certificate/certificate.go similarity index 93% rename from certificates/certificate.go rename to certificate/certificate.go index 9468d9e1..b75d2825 100644 --- a/certificates/certificate.go +++ b/certificate/certificate.go @@ -1,4 +1,4 @@ -package certificates +package certificate type Certificate struct { UUID string `db:"certificate_uuid" json:"uuid"` diff --git a/certificates/datastore.go b/certificate/datastore.go similarity index 99% rename from certificates/datastore.go rename to certificate/datastore.go index c96395fa..48fa5fd9 100644 --- a/certificates/datastore.go +++ b/certificate/datastore.go @@ -1,4 +1,4 @@ -package certificates +package certificate import ( "fmt" diff --git a/certificates/datastore_test.go b/certificate/datastore_test.go similarity index 96% rename from certificates/datastore_test.go rename to certificate/datastore_test.go index 04f6427d..d2f3a85d 100644 --- a/certificates/datastore_test.go +++ b/certificate/datastore_test.go @@ -1,4 +1,4 @@ -package certificates +package certificate import ( "database/sql" diff --git a/certificates/statement.go b/certificate/statement.go similarity index 98% rename from certificates/statement.go rename to certificate/statement.go index fd16b528..a2432913 100644 --- a/certificates/statement.go +++ b/certificate/statement.go @@ -1,4 +1,4 @@ -package certificates +package certificate import ( "fmt" diff --git a/certificates/statement_test.go b/certificate/statement_test.go similarity index 98% rename from certificates/statement_test.go rename to certificate/statement_test.go index bbdd4eb4..c1085328 100644 --- a/certificates/statement_test.go +++ b/certificate/statement_test.go @@ -1,4 +1,4 @@ -package certificates +package certificate import ( "testing" diff --git a/connect/service.go b/connect/service.go index df334f1b..32f00e96 100644 --- a/connect/service.go +++ b/connect/service.go @@ -5,8 +5,8 @@ import ( "encoding/json" "fmt" "github.com/micromdm/mdm" - apps "github.com/micromdm/micromdm/applications" - "github.com/micromdm/micromdm/certificates" + "github.com/micromdm/micromdm/application" + "github.com/micromdm/micromdm/certificate" "github.com/micromdm/micromdm/command" "github.com/micromdm/micromdm/device" "github.com/pkg/errors" @@ -22,7 +22,7 @@ type Service interface { } // NewService creates a mdm service -func NewService(devices device.Datastore, apps apps.Datastore, certs certificates.Datastore, cs command.Service) Service { +func NewService(devices device.Datastore, apps application.Datastore, certs certificate.Datastore, cs command.Service) Service { return &service{ commands: cs, devices: devices, @@ -33,9 +33,9 @@ func NewService(devices device.Datastore, apps apps.Datastore, certs certificate type service struct { devices device.Datastore - apps apps.Datastore + apps application.Datastore commands command.Service - certs certificates.Datastore + certs certificate.Datastore } // Acknowledge a response from a device. @@ -157,7 +157,7 @@ func (svc service) ackInstalledApplicationList(req mdm.Response) error { return fmt.Errorf("clearing applications for device: %s", err) } - var requestApps []apps.DeviceApplication = make([]apps.DeviceApplication, len(req.InstalledApplicationList)) + var requestApps []application.DeviceApplication = make([]application.DeviceApplication, len(req.InstalledApplicationList)) // Update or insert application records that do not exist, returning the UUID so that it can be inserted for // the device sending the response. for i, reqApp := range req.InstalledApplicationList { @@ -171,7 +171,7 @@ func (svc service) ackInstalledApplicationList(req mdm.Response) error { dynamicSize := sql.NullInt64{} dynamicSize.Scan(reqApp.DynamicSize) - newApp := apps.DeviceApplication{ + newApp := application.DeviceApplication{ DeviceUUID: dev.UUID, Name: reqApp.Name, Identifier: identifier, @@ -203,9 +203,9 @@ func (svc service) ackCertificateList(req mdm.Response) error { return errors.Wrap(err, "getting a device record by udid") } - var certs []certificates.Certificate = []certificates.Certificate{} + var certs []certificate.Certificate = []certificate.Certificate{} for _, cert := range req.CertificateList { - newCert := certificates.Certificate{ + newCert := certificate.Certificate{ CommonName: cert.CommonName, IsIdentity: cert.IsIdentity, Data: cert.Data, diff --git a/main.go b/main.go index 1c432907..5f8ccced 100644 --- a/main.go +++ b/main.go @@ -14,8 +14,8 @@ import ( "github.com/RobotsAndPencils/buford/push" "github.com/go-kit/kit/log" "github.com/micromdm/dep" - "github.com/micromdm/micromdm/applications" - "github.com/micromdm/micromdm/certificates" + "github.com/micromdm/micromdm/application" + mdmCert "github.com/micromdm/micromdm/certificate" "github.com/micromdm/micromdm/checkin" "github.com/micromdm/micromdm/command" "github.com/micromdm/micromdm/connect" @@ -189,7 +189,7 @@ func main() { os.Exit(1) } - appsDB, err := applications.NewDB( + appsDB, err := application.NewDB( "postgres", *flPGconn, logger, @@ -199,7 +199,7 @@ func main() { os.Exit(1) } - certsDB, err := certificates.NewDB( + certsDB, err := mdmCert.NewDB( "postgres", *flPGconn, logger, diff --git a/management/endpoint_certificates.go b/management/endpoint_certificates.go index b7bcc90f..3f0ce23b 100644 --- a/management/endpoint_certificates.go +++ b/management/endpoint_certificates.go @@ -3,7 +3,7 @@ package management import ( "encoding/json" "github.com/go-kit/kit/endpoint" - "github.com/micromdm/micromdm/certificates" + "github.com/micromdm/micromdm/certificate" "golang.org/x/net/context" "net/http" ) @@ -13,8 +13,8 @@ type listCertificatesRequest struct { } type listCertificatesResponse struct { - certificates []certificates.Certificate `json:"certificates,omitempty"` - Err error `json:"error,omitempty"` + certificates []certificate.Certificate `json:"certificates,omitempty"` + Err error `json:"error,omitempty"` } func (r listCertificatesResponse) error() error { return r.Err } diff --git a/management/endpoint_installedapps.go b/management/endpoint_installedapps.go index e74a9029..61bbb42e 100644 --- a/management/endpoint_installedapps.go +++ b/management/endpoint_installedapps.go @@ -2,7 +2,7 @@ package management import ( "github.com/go-kit/kit/endpoint" - "github.com/micromdm/micromdm/applications" + "github.com/micromdm/micromdm/application" "golang.org/x/net/context" ) @@ -11,7 +11,7 @@ type installedAppsRequest struct { } type installedAppsResponse struct { - applications []applications.Application + applications []application.Application Err error `json:"error,omitempty"` } diff --git a/management/service.go b/management/service.go index cb256578..b084f282 100644 --- a/management/service.go +++ b/management/service.go @@ -5,8 +5,8 @@ import ( "github.com/RobotsAndPencils/buford/payload" "github.com/RobotsAndPencils/buford/push" "github.com/micromdm/dep" - "github.com/micromdm/micromdm/applications" - "github.com/micromdm/micromdm/certificates" + "github.com/micromdm/micromdm/application" + "github.com/micromdm/micromdm/certificate" "github.com/micromdm/micromdm/device" "github.com/micromdm/micromdm/workflow" "github.com/pkg/errors" @@ -31,10 +31,10 @@ type Service interface { Device(uuid string) (*device.Device, error) // Installed Applications - InstalledApps(deviceUUID string) ([]applications.Application, error) + InstalledApps(deviceUUID string) ([]application.Application, error) // Installed Certificates - Certificates(deviceUUID string) ([]certificates.Certificate, error) + Certificates(deviceUUID string) ([]certificate.Certificate, error) // AssignWorkflow assigns a workflow to a device AssignWorkflow(deviceUUID, workflowUUID string) error @@ -48,7 +48,7 @@ type Service interface { } // NewService creates a management service -func NewService(ds device.Datastore, ws workflow.Datastore, dc dep.Client, ps *push.Service, as applications.Datastore, cs certificates.Datastore) Service { +func NewService(ds device.Datastore, ws workflow.Datastore, dc dep.Client, ps *push.Service, as application.Datastore, cs certificate.Datastore) Service { return &service{ devices: ds, depClient: dc, @@ -64,8 +64,8 @@ type service struct { devices device.Datastore workflows workflow.Datastore pushsvc *push.Service - applications applications.Datastore - certificates certificates.Datastore + applications application.Datastore + certificates certificate.Datastore } func (svc service) Push(deviceUDID string) (string, error) { @@ -172,7 +172,7 @@ func (svc service) AssignWorkflow(deviceUUID, workflowUUID string) error { return svc.devices.Save("assignWorkflow", dev) } -func (svc service) InstalledApps(deviceUUID string) ([]applications.Application, error) { +func (svc service) InstalledApps(deviceUUID string) ([]application.Application, error) { apps, err := svc.applications.GetApplicationsByDeviceUUID(deviceUUID) if err != nil { return nil, errors.Wrap(err, "management: installed apps") @@ -181,7 +181,7 @@ func (svc service) InstalledApps(deviceUUID string) ([]applications.Application, return apps, nil } -func (svc service) Certificates(deviceUUID string) ([]certificates.Certificate, error) { +func (svc service) Certificates(deviceUUID string) ([]certificate.Certificate, error) { certs, err := svc.certificates.GetCertificatesByDeviceUUID(deviceUUID) if err != nil { return nil, errors.Wrap(err, "management: certificates")