Documentation
¶
Overview ¶
Package tsigkeys provides information and interaction with the TSIG key API resource for the OpenStack DNS service.
TSIG (Transaction SIGnature) keys are used to authenticate DNS transactions between servers, such as zone transfers and dynamic updates.
Example to List TSIG Keys
listOpts := tsigkeys.ListOpts{
Scope: "POOL",
}
allPages, err := tsigkeys.List(dnsClient, listOpts).AllPages(context.TODO())
if err != nil {
panic(err)
}
allTSIGKeys, err := tsigkeys.ExtractTSIGKeys(allPages)
if err != nil {
panic(err)
}
for _, tsigkey := range allTSIGKeys {
fmt.Printf("%+v\n", tsigkey)
}
Example to Create a TSIG Key
createOpts := tsigkeys.CreateOpts{
Name: "mytsigkey",
Algorithm: "hmac-sha256",
Secret: "example-secret-key-value==",
Scope: "POOL",
ResourceID: "pool-id-here",
}
tsigkey, err := tsigkeys.Create(context.TODO(), dnsClient, createOpts).Extract()
if err != nil {
panic(err)
}
Example to Get a TSIG Key
tsigkeyID := "99d10f68-5623-4491-91a0-6daafa32b60e"
tsigkey, err := tsigkeys.Get(context.TODO(), dnsClient, tsigkeyID).Extract()
if err != nil {
panic(err)
}
Example to Update a TSIG Key
tsigkeyID := "99d10f68-5623-4491-91a0-6daafa32b60e"
updateOpts := tsigkeys.UpdateOpts{
Name: "updatedname",
Secret: "updated-secret-key-value==",
}
tsigkey, err := tsigkeys.Update(context.TODO(), dnsClient, tsigkeyID, updateOpts).Extract()
if err != nil {
panic(err)
}
Example to Delete a TSIG Key
tsigkeyID := "99d10f68-5623-4491-91a0-6daafa32b60e"
err := tsigkeys.Delete(context.TODO(), dnsClient, tsigkeyID).ExtractErr()
if err != nil {
panic(err)
}
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func List ¶
func List(client *gophercloud.ServiceClient, opts ListOptsBuilder) pagination.Pager
List implements a TSIG key List request.
Types ¶
type CreateOpts ¶
type CreateOpts struct {
// Name of the TSIG key.
Name string `json:"name" required:"true"`
// Algorithm is the TSIG algorithm (e.g., hmac-sha256, hmac-sha512).
Algorithm string `json:"algorithm" required:"true"`
// Secret is the base64-encoded secret key.
Secret string `json:"secret" required:"true"`
// Scope defines the scope of the TSIG key (ZONE or POOL).
Scope string `json:"scope" required:"true"`
// ResourceID is the ID of the resource (zone or pool) this key is associated with.
ResourceID string `json:"resource_id" required:"true"`
}
CreateOpts specifies the attributes used to create a TSIG key.
func (CreateOpts) ToTSIGKeyCreateMap ¶
func (opts CreateOpts) ToTSIGKeyCreateMap() (map[string]any, error)
ToTSIGKeyCreateMap formats a CreateOpts structure into a request body.
type CreateOptsBuilder ¶
CreateOptsBuilder allows extensions to add additional attributes to the Create request.
type CreateResult ¶
type CreateResult struct {
// contains filtered or unexported fields
}
CreateResult is the result of a Create request. Call its Extract method to interpret the result as a TSIGKey.
func Create ¶
func Create(ctx context.Context, client *gophercloud.ServiceClient, opts CreateOptsBuilder) (r CreateResult)
Create implements a TSIG key create request.
type DeleteResult ¶
type DeleteResult struct {
gophercloud.ErrResult
}
DeleteResult is the result of a Delete request. Call its ExtractErr method to determine if the request succeeded or failed.
func Delete ¶
func Delete(ctx context.Context, client *gophercloud.ServiceClient, tsigkeyID string) (r DeleteResult)
Delete implements a TSIG key delete request.
type GetResult ¶
type GetResult struct {
// contains filtered or unexported fields
}
GetResult is the result of a Get request. Call its Extract method to interpret the result as a TSIGKey.
func Get ¶
func Get(ctx context.Context, client *gophercloud.ServiceClient, tsigkeyID string) (r GetResult)
Get returns information about a TSIG key, given its ID.
type ListOpts ¶
type ListOpts struct {
// Integer value for the limit of values to return.
Limit int `q:"limit"`
// UUID of the TSIG key at which you want to set a marker.
Marker string `q:"marker"`
// Name of the TSIG key.
Name string `q:"name"`
// Algorithm used by the TSIG key.
Algorithm string `q:"algorithm"`
// Scope of the TSIG key (ZONE or POOL).
Scope string `q:"scope"`
}
ListOpts allows the filtering and sorting of paginated collections through the API. Filtering is achieved by passing in struct field values that map to the server attributes you want to see returned. Marker and Limit are used for pagination. https://docs.openstack.org/api-ref/dns/
func (ListOpts) ToTSIGKeyListQuery ¶
ToTSIGKeyListQuery formats a ListOpts into a query string.
type ListOptsBuilder ¶
ListOptsBuilder allows extensions to add parameters to the List request.
type TSIGKey ¶
type TSIGKey struct {
// ID uniquely identifies this TSIG key.
ID string `json:"id"`
// Name is the name of the TSIG key.
Name string `json:"name"`
// Algorithm is the TSIG algorithm used (e.g., hmac-sha256, hmac-sha512).
Algorithm string `json:"algorithm"`
// Secret is the base64-encoded secret key.
Secret string `json:"secret"`
// Scope defines the scope of the TSIG key (ZONE or POOL).
Scope string `json:"scope"`
// ResourceID is the ID of the resource (zone or pool) this key is associated with.
ResourceID string `json:"resource_id"`
// CreatedAt is the date when the TSIG key was created.
CreatedAt time.Time `json:"-"`
// UpdatedAt is the date when the TSIG key was last updated.
UpdatedAt time.Time `json:"-"`
// Links includes HTTP references to the itself.
Links map[string]any `json:"links"`
}
TSIGKey represents a TSIG key for DNS transaction authentication.
func ExtractTSIGKeys ¶
func ExtractTSIGKeys(r pagination.Page) ([]TSIGKey, error)
ExtractTSIGKeys extracts a slice of TSIGKeys from a List result.
func (*TSIGKey) UnmarshalJSON ¶
type TSIGKeyPage ¶
type TSIGKeyPage struct {
pagination.LinkedPageBase
}
TSIGKeyPage is a single page of TSIGKey results.
func (TSIGKeyPage) IsEmpty ¶
func (r TSIGKeyPage) IsEmpty() (bool, error)
IsEmpty returns true if the page contains no results.
type UpdateOpts ¶
type UpdateOpts struct {
// Name of the TSIG key.
Name string `json:"name,omitempty"`
// Algorithm is the TSIG algorithm.
Algorithm string `json:"algorithm,omitempty"`
// Secret is the base64-encoded secret key.
Secret string `json:"secret,omitempty"`
// Scope defines the scope of the TSIG key.
Scope string `json:"scope,omitempty"`
// ResourceID is the ID of the resource this key is associated with.
ResourceID string `json:"resource_id,omitempty"`
}
UpdateOpts specifies the attributes to update a TSIG key.
func (UpdateOpts) ToTSIGKeyUpdateMap ¶
func (opts UpdateOpts) ToTSIGKeyUpdateMap() (map[string]any, error)
ToTSIGKeyUpdateMap formats an UpdateOpts structure into a request body.
type UpdateOptsBuilder ¶
UpdateOptsBuilder allows extensions to add additional attributes to the Update request.
type UpdateResult ¶
type UpdateResult struct {
// contains filtered or unexported fields
}
UpdateResult is the result of an Update request. Call its Extract method to interpret the result as a TSIGKey.
func Update ¶
func Update(ctx context.Context, client *gophercloud.ServiceClient, tsigkeyID string, opts UpdateOptsBuilder) (r UpdateResult)
Update implements a TSIG key update request.