Documentation ¶
Index ¶
- type Acl
- type Authenticate
- type AuthenticateError
- type AuthorClusters
- type Client
- func (c *Client) BindPrincipalToRole(principal, roleName string, cDetails ClusterDetails) error
- func (c *Client) CreateAcl(clusterId string, aclConfig *Acl) error
- func (c *Client) CreatePrincipal(userPrincipal string, principals []UserPrincipalAction) (*UserPrincipal, error)
- func (c *Client) CreateTopic(clusterId, topicName string, partitionsCount, replicationFactor int, ...) error
- func (c *Client) DecreaseRoleBinding(principal, roleName string, uRoleBinding RoleBinding) error
- func (c *Client) DeleteAcl(clusterId, resourceName string) error
- func (c *Client) DeleteRoleBinding(principal, roleName string, cDetails ClusterDetails) error
- func (c *Client) DeleteTopic(clusterId, topicName string) error
- func (c *Client) DoRequest(method string, uri string, reqBody io.Reader) ([]byte, error)
- func (c *Client) GetKafkaCluster(clusterId string) (*KafkaCluster, error)
- func (c *Client) GetTopic(clusterId, topicName string) (*Topic, error)
- func (c *Client) GetTopicConfigs(clusterId string, topicName string) ([]TopicConfig, error)
- func (c *Client) GetTopicPartitions(clusterId, topicName string) ([]Partition, error)
- func (c *Client) IncreaseRoleBinding(principal, roleName string, uRoleBinding RoleBinding) error
- func (c *Client) IsReplicationFactorUpdating(topic string) (bool, error)
- func (c *Client) ListAcls(clusterId string) ([]Acl, error)
- func (c *Client) ListKafkaCluster() ([]KafkaCluster, error)
- func (c *Client) ListTopics(clusterId string) ([]Topic, error)
- func (c *Client) Login() (string, error)
- func (c *Client) LookupRoleBinding(principal, roleName string, cDetails ClusterDetails) ([]ResourcePattern, error)
- func (c *Client) OverwriteRoleBinding(principal, roleName string, uRoleBinding RoleBinding) error
- func (c *Client) UpdatePartitions(t Topic) error
- func (c *Client) UpdateReplicationsFactor(t Topic) error
- func (c *Client) UpdateTopicConfigs(clusterId string, topicName string, data []TopicConfig) error
- type ClusterDetails
- type Clusters
- type Config
- type DefaultHttpClient
- type DefaultSaramaClient
- func (k *DefaultSaramaClient) Brokers() []*sarama.Broker
- func (k *DefaultSaramaClient) Config() *sarama.Config
- func (k *DefaultSaramaClient) Controller() (*sarama.Broker, error)
- func (k *DefaultSaramaClient) ID(broker *sarama.Broker) int32
- func (k *DefaultSaramaClient) Partitions(topic string) ([]int32, error)
- func (k *DefaultSaramaClient) RefreshMetadata() error
- func (k *DefaultSaramaClient) Replicas(topic string, partitionId int32) ([]int32, error)
- type DefaultSaramaClusterAdmin
- type ErrorResponse
- type HttpClient
- type KafkaCluster
- type Metadata
- type Partition
- type Related
- type ReplicasAssignment
- type ResourcePattern
- type RoleBinding
- type SaramaClient
- type SaramaClusterAdmin
- type Scope
- type Synonyms
- type Topic
- type TopicConfig
- type UserPrincipal
- type UserPrincipalAction
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Acl ¶
type Acl struct { ClusterId string `json:"cluster_id,omitempty"` ResourceType string `json:"resource_type,omitempty"` ResourceName string `json:"resource_name,omitempty"` PatternType string `json:"pattern_type,omitempty"` Principal string `json:"principal,omitempty"` Host string `json:"host,omitempty"` Operation string `json:"operation,omitempty"` Permission string `json:"permission,omitempty"` }
type Authenticate ¶
type AuthenticateError ¶
type AuthorClusters ¶
type AuthorClusters struct {
KafkaCluster string `json:"kafka-cluster"`
}
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client will provide all Confluent clients
func NewClient ¶
func NewClient(httpClient HttpClient, saramaClient SaramaClient, saramaClusterAdmin SaramaClusterAdmin) *Client
func (*Client) BindPrincipalToRole ¶
func (c *Client) BindPrincipalToRole(principal, roleName string, cDetails ClusterDetails) error
BindPrincipalToRole will bind the principal to a cluster-scoped role for a specific cluster or in a given scope
func (*Client) CreateAcl ¶
Creates an ACL. @ref https://docs.confluent.io/platform/current/kafka-rest/api.html#post--clusters-cluster_id-acls
func (*Client) CreatePrincipal ¶
func (c *Client) CreatePrincipal(userPrincipal string, principals []UserPrincipalAction) (*UserPrincipal, error)
func (*Client) CreateTopic ¶
func (c *Client) CreateTopic(clusterId, topicName string, partitionsCount, replicationFactor int, configs []TopicConfig, replicasAssignments []ReplicasAssignment) error
func (*Client) DecreaseRoleBinding ¶
func (c *Client) DecreaseRoleBinding(principal, roleName string, uRoleBinding RoleBinding) error
DecreaseRoleBinding : Incrementally remove the resources from the principal at the given scope/cluster using the given role
func (*Client) DeleteAcl ¶
Deletes the list of ACLs that matches the search criteria. Parameters:
cluster_id (string) – The Kafka cluster ID.
Query Parameters:
resource_type (string) – The ACL resource type. resource_name (string) – The ACL resource name. pattern_type (string) – The ACL pattern type. principal (string) – The ACL principal. host (string) – The ACL host. operation (string) – The ACL operation. permission (string) – The ACL permission.
@ref https://docs.confluent.io/platform/current/kafka-rest/api.html#delete--clusters-cluster_id-acls
func (*Client) DeleteRoleBinding ¶
func (c *Client) DeleteRoleBinding(principal, roleName string, cDetails ClusterDetails) error
DeleteRoleBinding remove the role (cluster or resource scoped) from the principal at the give scope/cluster
func (*Client) DeleteTopic ¶
func (*Client) GetKafkaCluster ¶
func (c *Client) GetKafkaCluster(clusterId string) (*KafkaCluster, error)
Returns the Kafka cluster with the specified cluster_id. @ref https://docs.confluent.io/platform/current/kafka-rest/api.html#get--clusters-cluster_id
func (*Client) GetTopicConfigs ¶
func (c *Client) GetTopicConfigs(clusterId string, topicName string) ([]TopicConfig, error)
@ref https://docs.confluent.io/platform/current/kafka-rest/api.html#get--clusters-cluster_id-topics-topic_name-configs Return the list of configs that belong to the specified topic.
func (*Client) GetTopicPartitions ¶
func (*Client) IncreaseRoleBinding ¶
func (c *Client) IncreaseRoleBinding(principal, roleName string, uRoleBinding RoleBinding) error
IncreaseRoleBinding : incrementally grant the resources to the principal at the given scope/cluster using the given role
func (*Client) IsReplicationFactorUpdating ¶
func (*Client) ListAcls ¶
Returns a list of ACLs that match the search criteria. Parameters:
cluster_id (string) – The Kafka cluster ID.
Query Parameters:
resource_type (string) – The ACL resource type. resource_name (string) – The ACL resource name. pattern_type (string) – The ACL pattern type. principal (string) – The ACL principal. host (string) – The ACL host. operation (string) – The ACL operation. permission (string) – The ACL permission.
@ref https://docs.confluent.io/platform/current/kafka-rest/api.html#get--clusters-cluster_id-acls
func (*Client) ListKafkaCluster ¶
func (c *Client) ListKafkaCluster() ([]KafkaCluster, error)
Returns a list of known Kafka clusters. Currently both Kafka and Kafka REST Proxy are only aware of the Kafka cluster pointed at by the bootstrap.servers configuration. Therefore only one Kafka cluster will be returned in the response. @ref https://docs.confluent.io/platform/current/kafka-rest/api.html#get--clusters
func (*Client) LookupRoleBinding ¶
func (c *Client) LookupRoleBinding(principal, roleName string, cDetails ClusterDetails) ([]ResourcePattern, error)
LookupRoleBinding will lookup the role-bindings for the principal at the given scope/cluster using the given role
func (*Client) OverwriteRoleBinding ¶
func (c *Client) OverwriteRoleBinding(principal, roleName string, uRoleBinding RoleBinding) error
OverwriteRoleBinding will overwrite existing resource grants
func (*Client) UpdatePartitions ¶
func (*Client) UpdateReplicationsFactor ¶
func (*Client) UpdateTopicConfigs ¶
func (c *Client) UpdateTopicConfigs(clusterId string, topicName string, data []TopicConfig) error
@ref Return the list of configs that belong to the specified topic. Updates or deletes a set of topic configs.
type ClusterDetails ¶
type Clusters ¶
type Clusters struct { // Kafka cluster ID KafkaCluster string `json:"kafka-cluster,omitempty"` // Kafka Connect Cluster ID ConnectCluster string `json:"connect-cluster,omitempty"` // kSQL cluster ID KSqlCluster string `json:"ksql-cluster,omitempty"` // Schema Registry Cluster ID SchemaRegistryCluster string `json:"schema-registry-cluster,omitempty"` }
Clusters active in Confluent system Support: - kafka cluster - Kafka connect cluster - KSql cluster - Schema Registry cluster @ref https://docs.confluent.io/platform/current/kafka-rest/api.html#cluster
type DefaultHttpClient ¶
type DefaultHttpClient struct { // BaseURL : https://localhost:8090 // API endpoint of Confluent platform BaseUrl string // Define the user-agent would be sent to confluent api // Default: confluent-client-go-sdk Username string Password string Token string UserAgent string }
func NewDefaultHttpClient ¶
func NewDefaultHttpClient(baseUrl string, username string, password string) *DefaultHttpClient
type DefaultSaramaClient ¶
type DefaultSaramaClient struct {
// contains filtered or unexported fields
}
func NewDefaultSaramaClient ¶
func NewDefaultSaramaClient(config *Config) (*DefaultSaramaClient, sarama.Client, error)
Init kafka client point to sarama client
func (*DefaultSaramaClient) Brokers ¶
func (k *DefaultSaramaClient) Brokers() []*sarama.Broker
func (*DefaultSaramaClient) Config ¶
func (k *DefaultSaramaClient) Config() *sarama.Config
func (*DefaultSaramaClient) Controller ¶
func (k *DefaultSaramaClient) Controller() (*sarama.Broker, error)
func (*DefaultSaramaClient) Partitions ¶
func (k *DefaultSaramaClient) Partitions(topic string) ([]int32, error)
func (*DefaultSaramaClient) RefreshMetadata ¶
func (k *DefaultSaramaClient) RefreshMetadata() error
type DefaultSaramaClusterAdmin ¶
type DefaultSaramaClusterAdmin struct {
// contains filtered or unexported fields
}
func (*DefaultSaramaClusterAdmin) AlterPartitionReassignments ¶
func (ca *DefaultSaramaClusterAdmin) AlterPartitionReassignments(topic string, assignment [][]int32) error
func (*DefaultSaramaClusterAdmin) ListPartitionReassignments ¶
func (ca *DefaultSaramaClusterAdmin) ListPartitionReassignments(topic string, partitions []int32) (map[string]map[int32]*sarama.PartitionReplicaReassignmentsStatus, error)
type ErrorResponse ¶
type ErrorResponse struct { StatusCode int `json:"status_code,omitempty"` ErrorCode int `json:"error_code"` Type string `json:"type,omitempty"` Message string `json:"message"` Errors []struct { ErrorType string `json:"error_type,omitempty"` Message string `json:"message,omitempty"` } `json:"errors,omitempty"` }
type HttpClient ¶
type KafkaCluster ¶
type KafkaCluster struct {
ClusterID string `json:"cluster_id"`
}
type ReplicasAssignment ¶
type ResourcePattern ¶
type RoleBinding ¶
type RoleBinding struct { Scope ClusterDetails `json:"scope"` ResourcePatterns []ResourcePattern `json:"resourcePatterns"` }
type SaramaClient ¶
type SaramaClusterAdmin ¶
type SaramaClusterAdmin interface { ListPartitionReassignments(topic string, partitions []int32) (map[string]map[int32]*sarama.PartitionReplicaReassignmentsStatus, error) AlterPartitionReassignments(topic string, assignment [][]int32) error }
func NewDefaultSaramaClusterAdmin ¶
func NewDefaultSaramaClusterAdmin(saramaClient sarama.Client) (SaramaClusterAdmin, error)
type Scope ¶
type Scope struct {
Clusters AuthorClusters `json:"clusters"`
}
type Topic ¶
type Topic struct { ClusterID string `json:"cluster_id,omitempty"` IsInternal bool `json:"is_internal,omitempty"` Name string `json:"topic_name"` Partitions int32 `json:"partitions_count,omitempty"` ReplicationFactor int16 `json:"replication_factor,omitempty"` Config []TopicConfig `json:"configs,omitempty"` ReplicasAssignments []ReplicasAssignment `json:"replicas_assignments,omitempty"` PartitionsDetails []Partition `json:"partitions_details,omitempty"` }
type TopicConfig ¶
type TopicConfig struct { ClusterId string `json:"cluster_id,omitempty"` TopicName string `json:"topic_name,omitempty"` Name string `json:"name"` Value string `json:"value"` IsDefault bool `json:"is_default,omitempty"` IsReadOnly bool `json:"is_read_only,omitempty"` IsSensitive bool `json:"is_sensitive,omitempty"` Source string `json:"source,omitempty"` Synonyms []Synonyms `json:"synonyms,omitempty"` }
type UserPrincipal ¶
type UserPrincipal struct { // UserPrincipal example: User:<Username> UserPrincipal string `json:"userPrincipal"` // Actions allow or deny for this principal Actions []UserPrincipalAction `json:"actions"` }