Skip to content

Commit

Permalink
Merge pull request #23 from karimra/cert-api
Browse files Browse the repository at this point in the history
add cert api
  • Loading branch information
karimra authored May 17, 2022
2 parents 1ab3320 + 8529ad4 commit 5ac382f
Show file tree
Hide file tree
Showing 10 changed files with 619 additions and 29 deletions.
21 changes: 21 additions & 0 deletions api/cert/can_generate_csr.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package cert

import "github.com/openconfig/gnoi/cert"

func NewCertCanGenerateCSRRequest(opts ...CertOption) (*cert.CanGenerateCSRRequest, error) {
m := new(cert.CanGenerateCSRRequest)
err := apply(m, opts...)
if err != nil {
return nil, err
}
return m, nil
}

func NewCertCanGenerateCSRResponse(opts ...CertOption) (*cert.CanGenerateCSRResponse, error) {
m := new(cert.CanGenerateCSRResponse)
err := apply(m, opts...)
if err != nil {
return nil, err
}
return m, nil
}
21 changes: 21 additions & 0 deletions api/cert/generate_csr.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package cert

import "github.com/openconfig/gnoi/cert"

func NewCertGenerateCSRRequest(opts ...CertOption) (*cert.GenerateCSRRequest, error) {
m := new(cert.GenerateCSRRequest)
err := apply(m, opts...)
if err != nil {
return nil, err
}
return m, nil
}

func NewCertGenerateCSRResponse(opts ...CertOption) (*cert.GenerateCSRResponse, error) {
m := new(cert.GenerateCSRResponse)
err := apply(m, opts...)
if err != nil {
return nil, err
}
return m, nil
}
21 changes: 21 additions & 0 deletions api/cert/get.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package cert

import "github.com/openconfig/gnoi/cert"

func NewCertGetCertificatesRequest(opts ...CertOption) (*cert.GetCertificatesRequest, error) {
m := new(cert.GetCertificatesRequest)
err := apply(m, opts...)
if err != nil {
return nil, err
}
return m, nil
}

func NewCertGetCertificatesResponse(opts ...CertOption) (*cert.GetCertificatesResponse, error) {
m := new(cert.GetCertificatesResponse)
err := apply(m, opts...)
if err != nil {
return nil, err
}
return m, nil
}
51 changes: 51 additions & 0 deletions api/cert/install.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
package cert

import "github.com/openconfig/gnoi/cert"

func NewCertInstallGenerateCSRRequest(opts ...CertOption) (*cert.InstallCertificateRequest, error) {
m, err := NewCertGenerateCSRRequest(opts...)
if err != nil {
return nil, err
}
return &cert.InstallCertificateRequest{
InstallRequest: &cert.InstallCertificateRequest_GenerateCsr{
GenerateCsr: m,
},
}, nil
}

func NewCertInstallLoadCertificateRequest(opts ...CertOption) (*cert.InstallCertificateRequest, error) {
m, err := NewCertLoadCertificateRequest(opts...)
if err != nil {
return nil, err
}
return &cert.InstallCertificateRequest{
InstallRequest: &cert.InstallCertificateRequest_LoadCertificate{
LoadCertificate: m,
},
}, nil
}

func NewCertInstallGenerateCSRResponse(opts ...CertOption) (*cert.InstallCertificateResponse, error) {
m, err := NewCertGenerateCSRResponse(opts...)
if err != nil {
return nil, err
}
return &cert.InstallCertificateResponse{
InstallResponse: &cert.InstallCertificateResponse_GeneratedCsr{
GeneratedCsr: m,
},
}, nil
}

func NewCertInstallLoadCertificateResponse(opts ...CertOption) (*cert.InstallCertificateResponse, error) {
m, err := NewCertLoadCertificateResponse(opts...)
if err != nil {
return nil, err
}
return &cert.InstallCertificateResponse{
InstallResponse: &cert.InstallCertificateResponse_LoadCertificate{
LoadCertificate: m,
},
}, nil
}
21 changes: 21 additions & 0 deletions api/cert/load.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package cert

import "github.com/openconfig/gnoi/cert"

func NewCertLoadCertificateRequest(opts ...CertOption) (*cert.LoadCertificateRequest, error) {
m := new(cert.LoadCertificateRequest)
err := apply(m, opts...)
if err != nil {
return nil, err
}
return m, nil
}

func NewCertLoadCertificateResponse(opts ...CertOption) (*cert.LoadCertificateResponse, error) {
m := new(cert.LoadCertificateResponse)
err := apply(m, opts...)
if err != nil {
return nil, err
}
return m, nil
}
21 changes: 21 additions & 0 deletions api/cert/load_ca_bundle.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package cert

import "github.com/openconfig/gnoi/cert"

func NewCertLoadCertificateAuthorityBundleRequest(opts ...CertOption) (*cert.LoadCertificateAuthorityBundleRequest, error) {
m := new(cert.LoadCertificateAuthorityBundleRequest)
err := apply(m, opts...)
if err != nil {
return nil, err
}
return m, nil
}

func NewCertLoadCertificateAuthorityBundleResponse(opts ...CertOption) (*cert.LoadCertificateAuthorityBundleResponse, error) {
m := new(cert.LoadCertificateAuthorityBundleResponse)
err := apply(m, opts...)
if err != nil {
return nil, err
}
return m, nil
}
Loading

0 comments on commit 5ac382f

Please sign in to comment.