Documentation
¶
Overview ¶
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrClusterNotExist means a cluster doesn't exist. ErrClusterNotExist = errors.New("client not exist") // ErrDuplicatedCluster means the cluster adding request was // rejected since the cluster was already created. ErrDuplicatedCluster = errors.New("duplicated cluster") // ErrFunctionDisabled means the APISIX function is disabled ErrFunctionDisabled = errors.New("function disabled") )
Functions ¶
This section is empty.
Types ¶
type APISIX ¶
type APISIX interface { // Cluster specifies the target cluster to talk. Cluster(string) Cluster // AddCluster adds a new cluster. AddCluster(context.Context, *ClusterOptions) error // UpdateCluster updates an existing cluster. UpdateCluster(context.Context, *ClusterOptions) error // ListClusters lists all APISIX clusters. ListClusters() []Cluster // DeleteCluster deletes the target APISIX cluster by its name. DeleteCluster(string) }
APISIX is the unified client tool to communicate with APISIX.
type Cluster ¶
type Cluster interface { // Route returns a Route interface that can operate Route resources. Route() Route // Upstream returns a Upstream interface that can operate Upstream resources. Upstream() Upstream // SSL returns a SSL interface that can operate SSL resources. SSL() SSL // StreamRoute returns a StreamRoute interface that can operate StreamRoute resources. StreamRoute() StreamRoute // GlobalRule returns a GlobalRule interface that can operate GlobalRule resources. GlobalRule() GlobalRule // String exposes the client information in human readable format. String() string // HasSynced checks whether all resources in APISIX cluster is synced to cache. HasSynced(context.Context) error // Consumer returns a Consumer interface that can operate Consumer resources. Consumer() Consumer // HealthCheck checks apisix cluster health in realtime. HealthCheck(context.Context) error // Plugin returns a Plugin interface that can operate Plugin resources. Plugin() Plugin // PluginConfig returns a PluginConfig interface that can operate PluginConfig resources. PluginConfig() PluginConfig // Schema returns a Schema interface that can fetch schema of APISIX objects. Schema() Schema }
Cluster defines specific operations that can be applied in an APISIX cluster.
type ClusterOptions ¶
type ClusterOptions struct { Name string AdminKey string BaseURL string Timeout time.Duration // SyncInterval is the interval to sync schema. SyncInterval types.TimeDuration MetricsCollector metrics.Collector }
ClusterOptions contains parameters to customize APISIX client.
type Consumer ¶ added in v1.0.0
type Consumer interface { Get(context.Context, string) (*v1.Consumer, error) List(context.Context) ([]*v1.Consumer, error) Create(context.Context, *v1.Consumer) (*v1.Consumer, error) Delete(context.Context, *v1.Consumer) error Update(context.Context, *v1.Consumer) (*v1.Consumer, error) }
Consumer is the specific client interface to take over the create, update, list and delete for APISIX Consumer resource.
type GlobalRule ¶ added in v1.0.0
type GlobalRule interface { Get(context.Context, string) (*v1.GlobalRule, error) List(context.Context) ([]*v1.GlobalRule, error) Create(context.Context, *v1.GlobalRule) (*v1.GlobalRule, error) Delete(context.Context, *v1.GlobalRule) error Update(context.Context, *v1.GlobalRule) (*v1.GlobalRule, error) }
GlobalRule is the specific client interface to take over the create, update, list and delete for APISIX Global Rule resource.
type IntOrString ¶ added in v1.0.0
type IntOrString struct {
IntValue int `json:"int_value"`
}
IntOrString processing number and string types, after json deserialization will output int
func (*IntOrString) UnmarshalJSON ¶ added in v1.0.0
func (ios *IntOrString) UnmarshalJSON(p []byte) error
type Plugin ¶ added in v1.2.0
Plugin is the specific client interface to fetch APISIX Plugin resource.
type PluginConfig ¶ added in v1.4.0
type PluginConfig interface { Get(context.Context, string) (*v1.PluginConfig, error) List(context.Context) ([]*v1.PluginConfig, error) Create(context.Context, *v1.PluginConfig) (*v1.PluginConfig, error) Delete(context.Context, *v1.PluginConfig) error Update(context.Context, *v1.PluginConfig) (*v1.PluginConfig, error) }
PluginConfig is the specific client interface to take over the create, update, list and delete for APISIX PluginConfig resource.
type Route ¶
type Route interface { Get(context.Context, string) (*v1.Route, error) List(context.Context) ([]*v1.Route, error) Create(context.Context, *v1.Route) (*v1.Route, error) Delete(context.Context, *v1.Route) error Update(context.Context, *v1.Route) (*v1.Route, error) }
Route is the specific client interface to take over the create, update, list and delete for APISIX Route resource.
type SSL ¶
type SSL interface { Get(context.Context, string) (*v1.Ssl, error) List(context.Context) ([]*v1.Ssl, error) Create(context.Context, *v1.Ssl) (*v1.Ssl, error) Delete(context.Context, *v1.Ssl) error Update(context.Context, *v1.Ssl) (*v1.Ssl, error) }
SSL is the specific client interface to take over the create, update, list and delete for APISIX SSL resource.
type Schema ¶ added in v1.2.0
type Schema interface { GetPluginSchema(context.Context, string) (*v1.Schema, error) GetRouteSchema(context.Context) (*v1.Schema, error) GetUpstreamSchema(context.Context) (*v1.Schema, error) GetConsumerSchema(context.Context) (*v1.Schema, error) GetSslSchema(context.Context) (*v1.Schema, error) GetPluginConfigSchema(ctx context.Context) (*v1.Schema, error) }
Schema is the specific client interface to fetch the schema of APISIX objects.
type StreamRoute ¶ added in v1.0.0
type StreamRoute interface { Get(context.Context, string) (*v1.StreamRoute, error) List(context.Context) ([]*v1.StreamRoute, error) Create(context.Context, *v1.StreamRoute) (*v1.StreamRoute, error) Delete(context.Context, *v1.StreamRoute) error Update(context.Context, *v1.StreamRoute) (*v1.StreamRoute, error) }
StreamRoute is the specific client interface to take over the create, update, list and delete for APISIX Stream Route resource.
type Upstream ¶
type Upstream interface { Get(context.Context, string) (*v1.Upstream, error) List(context.Context) ([]*v1.Upstream, error) Create(context.Context, *v1.Upstream) (*v1.Upstream, error) Delete(context.Context, *v1.Upstream) error Update(context.Context, *v1.Upstream) (*v1.Upstream, error) }
Upstream is the specific client interface to take over the create, update, list and delete for APISIX Upstream resource.