github.com/sacloud/iaas-api-go@v1.12.0/naked/certificate_authority.go (about)

     1  // Copyright 2022-2023 The sacloud/iaas-api-go Authors
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //      http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  package naked
    16  
    17  import (
    18  	"time"
    19  
    20  	"github.com/sacloud/iaas-api-go/types"
    21  )
    22  
    23  // CertificateAuthority プライベートCA
    24  type CertificateAuthority struct {
    25  	ID           types.ID                      `json:",omitempty" yaml:"id,omitempty" structs:",omitempty"`
    26  	Name         string                        `json:",omitempty" yaml:"name,omitempty" structs:",omitempty"`
    27  	Description  string                        `yaml:"description"`
    28  	Tags         types.Tags                    `yaml:"tags"`
    29  	Icon         *Icon                         `json:",omitempty" yaml:"icon,omitempty" structs:",omitempty"`
    30  	CreatedAt    *time.Time                    `json:",omitempty" yaml:"created_at,omitempty" structs:",omitempty"`
    31  	ModifiedAt   *time.Time                    `json:",omitempty" yaml:"modified_at,omitempty" structs:",omitempty"`
    32  	Availability types.EAvailability           `json:",omitempty" yaml:"availability,omitempty" structs:",omitempty"`
    33  	ServiceClass string                        `json:",omitempty" yaml:"service_class,omitempty" structs:",omitempty"`
    34  	Provider     *Provider                     `json:",omitempty" yaml:"provider,omitempty" structs:",omitempty"`
    35  	Settings     *CertificateAuthoritySettings `json:",omitempty" yaml:"settings,omitempty" structs:",omitempty"`
    36  	SettingsHash string                        `json:",omitempty" yaml:"settings_hash,omitempty" structs:",omitempty"`
    37  	Status       *CertificateAuthorityStatus   `json:",omitempty" yaml:"status,omitempty" structs:",omitempty"`
    38  }
    39  
    40  // CertificateAuthorityStatus CertificateAuthorityステータス
    41  type CertificateAuthorityStatus struct {
    42  	Country          string    `json:"country,omitempty" yaml:"country,omitempty" structs:",omitempty"`
    43  	Organization     string    `json:"organization,omitempty" yaml:"organization,omitempty" structs:",omitempty"`
    44  	OrganizationUnit []string  `json:"organization_unit,omitempty" yaml:"organization_unit,omitempty" structs:",omitempty"`
    45  	CommonName       string    `json:"common_name,omitempty" yaml:"common_name,omitempty" structs:",omitempty"`
    46  	NotAfter         time.Time `json:"not_after,omitempty" yaml:"not_after,omitempty" structs:",omitempty"`
    47  	Subject          string    `json:"subject,omitempty" yaml:"subject,omitempty" structs:",omitempty"`
    48  }
    49  
    50  // CertificateAuthoritySettings CertificateAuthorityセッティング
    51  type CertificateAuthoritySettings struct {
    52  	// 現在は常に空となる。実際の設定は以下APIからCA/クライアント/サーバ別で取得する
    53  	//
    54  	// CA: GET /commonserviceitem/:id/certificateauthority
    55  	// サーバ証明書: GET /commonserviceitem/:id/certificateauthority/servers
    56  	// クライアント証明書: GET /commonserviceitem/:id/certificateauthority/clients
    57  }
    58  
    59  // CertificateAuthorityDetail CAの詳細情報
    60  //
    61  // GET /commonserviceitem/:id/certificateauthorityの戻り値
    62  type CertificateAuthorityDetail struct {
    63  	Subject         string           `json:"subject,omitempty" yaml:"subject,omitempty" structs:",omitempty"`
    64  	CertificateData *CertificateData `json:"certificate_data,omitempty" yaml:"certificate_data,omitempty" structs:",omitempty"`
    65  }
    66  
    67  // CertificateAuthorityServerDetail サーバ証明書の詳細情報
    68  //
    69  // GET /commonserviceitem/:id/certificateauthority/serversの戻り値を構成する
    70  // (実際にはFind系のラッパーがある)
    71  type CertificateAuthorityServerDetail struct {
    72  	ID              string           `json:"id,omitempty" yaml:"id,omitempty" structs:",omitempty"`
    73  	Subject         string           `json:"subject,omitempty" yaml:"subject,omitempty" structs:",omitempty"`
    74  	SANs            []string         `json:"sans,omitempty" yaml:"sans,omitempty" structs:",omitempty"`
    75  	EMail           string           `json:"email,omitempty" yaml:"email,omitempty" structs:",omitempty"`
    76  	IssueState      string           `json:"issue_state,omitempty" yaml:"issue_state,omitempty" structs:",omitempty"`
    77  	CertificateData *CertificateData `json:"certificate_data,omitempty" yaml:"certificate_data,omitempty" structs:",omitempty"`
    78  	URL             string           `json:"url,omitempty" yaml:"url,omitempty" structs:",omitempty"` // 常に空のはず
    79  }
    80  
    81  // CertificateAuthorityClientDetail クライアント証明書の詳細情報
    82  //
    83  // GET /commonserviceitem/:id/certificateauthority/clientsの戻り値を構成する
    84  // (実際にはFind系のラッパーがある)
    85  type CertificateAuthorityClientDetail struct {
    86  	ID              string                                    `json:"id,omitempty" yaml:"id,omitempty" structs:",omitempty"`
    87  	Subject         string                                    `json:"subject,omitempty" yaml:"subject,omitempty" structs:",omitempty"`
    88  	EMail           string                                    `json:"email,omitempty" yaml:"email,omitempty" structs:",omitempty"`
    89  	IssuanceMethod  types.ECertificateAuthorityIssuanceMethod `json:"issuance_method,omitempty" yaml:"issuance_method,omitempty" structs:",omitempty"`
    90  	IssueState      string                                    `json:"issue_state,omitempty" yaml:"issue_state,omitempty" structs:",omitempty"`
    91  	CertificateData *CertificateData                          `json:"certificate_data,omitempty" yaml:"certificate_data,omitempty" structs:",omitempty"`
    92  	URL             string                                    `json:"url,omitempty" yaml:"url,omitempty" structs:",omitempty"`
    93  }
    94  
    95  // CertificateData CA/クライアント/サーバの各証明書の情報
    96  type CertificateData struct {
    97  	CertificatePEM string    `json:"certificate_pem,omitempty" yaml:"certificate_pem,omitempty" structs:",omitempty"`
    98  	Subject        string    `json:"subject,omitempty" yaml:"subject,omitempty" structs:",omitempty"`
    99  	SerialNumber   string    `json:"serial_number,omitempty" yaml:"serial_number,omitempty" structs:",omitempty"`
   100  	NotBefore      time.Time `json:"not_before,omitempty" yaml:"not_before,omitempty" structs:",omitempty"`
   101  	NotAfter       time.Time `json:"not_after,omitempty" yaml:"not_after,omitempty" structs:",omitempty"`
   102  }
   103  
   104  type CertificateAuthorityAddClientParameter struct {
   105  	Status *CertificateAuthorityAddClientParameterBody `json:",omitempty" yaml:",omitempty" structs:",omitempty"`
   106  }
   107  
   108  type CertificateAuthorityAddClientParameterBody struct {
   109  	Country                   string                                    `json:"country,omitempty" yaml:"country,omitempty" structs:",omitempty"`
   110  	Organization              string                                    `json:"organization,omitempty" yaml:"organization,omitempty" structs:",omitempty"`
   111  	OrganizationUnit          []string                                  `json:"organization_unit,omitempty" yaml:"organization_unit,omitempty" structs:",omitempty"`
   112  	CommonName                string                                    `json:"common_name,omitempty" yaml:"common_name,omitempty" structs:",omitempty"`
   113  	NotAfter                  time.Time                                 `json:"not_after,omitempty" yaml:"not_after,omitempty" structs:",omitempty"`
   114  	EMail                     string                                    `json:"email,omitempty" yaml:"email,omitempty" structs:",omitempty"`
   115  	IssuanceMethod            types.ECertificateAuthorityIssuanceMethod `json:"issuance_method,omitempty" yaml:"issuance_method,omitempty" structs:",omitempty"`
   116  	CertificateSigningRequest string                                    `json:"certificate_signing_request,omitempty" yaml:"certificate_signing_request,omitempty" structs:",omitempty"`
   117  	PublicKey                 string                                    `json:"public_key,omitempty" yaml:"public_key,omitempty" structs:",omitempty"`
   118  }
   119  
   120  type CertificateAuthorityAddServerParameter struct {
   121  	Status *CertificateAuthorityAddServerParameterBody `json:",omitempty" yaml:",omitempty" structs:",omitempty"`
   122  }
   123  
   124  type CertificateAuthorityAddServerParameterBody struct {
   125  	Country                   string    `json:"country,omitempty" yaml:"country,omitempty" structs:",omitempty"`
   126  	Organization              string    `json:"organization,omitempty" yaml:"organization,omitempty" structs:",omitempty"`
   127  	OrganizationUnit          []string  `json:"organization_unit,omitempty" yaml:"organization_unit,omitempty" structs:",omitempty"`
   128  	CommonName                string    `json:"common_name,omitempty" yaml:"common_name,omitempty" structs:",omitempty"`
   129  	NotAfter                  time.Time `json:"not_after,omitempty" yaml:"not_after,omitempty" structs:",omitempty"`
   130  	SANs                      []string  `json:"sans,omitempty" yaml:"sans,omitempty" structs:",omitempty"`
   131  	CertificateSigningRequest string    `json:"certificate_signing_request,omitempty" yaml:"certificate_signing_request,omitempty" structs:",omitempty"`
   132  	PublicKey                 string    `json:"public_key,omitempty" yaml:"public_key,omitempty" structs:",omitempty"`
   133  }
   134  
   135  type CertificateAuthorityAddClientOrServerResult struct {
   136  	ID string `json:"id,omitempty" yaml:"id,omitempty" structs:",omitempty"`
   137  }