github.com/letsencrypt/boulder@v0.20251208.0/cmd/admin/dryrun.go (about)

     1  package main
     2  
     3  import (
     4  	"context"
     5  
     6  	"google.golang.org/grpc"
     7  	"google.golang.org/protobuf/encoding/prototext"
     8  	"google.golang.org/protobuf/types/known/emptypb"
     9  
    10  	blog "github.com/letsencrypt/boulder/log"
    11  	rapb "github.com/letsencrypt/boulder/ra/proto"
    12  	sapb "github.com/letsencrypt/boulder/sa/proto"
    13  )
    14  
    15  type dryRunRAC struct {
    16  	rapb.RegistrationAuthorityClient
    17  	log blog.Logger
    18  }
    19  
    20  func (d dryRunRAC) AdministrativelyRevokeCertificate(_ context.Context, req *rapb.AdministrativelyRevokeCertificateRequest, _ ...grpc.CallOption) (*emptypb.Empty, error) {
    21  	b, err := prototext.Marshal(req)
    22  	if err != nil {
    23  		return nil, err
    24  	}
    25  	d.log.Infof("dry-run: %#v", string(b))
    26  	return &emptypb.Empty{}, nil
    27  }
    28  
    29  type dryRunSAC struct {
    30  	sapb.StorageAuthorityClient
    31  	log blog.Logger
    32  }
    33  
    34  func (d dryRunSAC) AddBlockedKey(_ context.Context, req *sapb.AddBlockedKeyRequest, _ ...grpc.CallOption) (*emptypb.Empty, error) {
    35  	d.log.Infof("dry-run: Block SPKI hash %x by %s %s", req.KeyHash, req.Comment, req.Source)
    36  	return &emptypb.Empty{}, nil
    37  }