|
| 1 | +package admin |
| 2 | + |
| 3 | +import ( |
| 4 | + "context" |
| 5 | + i00eb2e63d156923d00d8e86fe16b5d74daf30e363c9f185a8165cb42aa2f2c71 "github.com/apicurio/apicurio-registry/go-sdk/pkg/registryclient-v3/models" |
| 6 | + i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f "github.com/microsoft/kiota-abstractions-go" |
| 7 | +) |
| 8 | + |
| 9 | +// ConfigTriggerSnapshotRequestBuilder triggers a snapshot of the Registry storage. Only supported in KafkaSQL storage |
| 10 | +type ConfigTriggerSnapshotRequestBuilder struct { |
| 11 | + i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.BaseRequestBuilder |
| 12 | +} |
| 13 | + |
| 14 | +// ConfigTriggerSnapshotRequestBuilderGetRequestConfiguration configuration for the request such as headers, query parameters, and middleware options. |
| 15 | +type ConfigTriggerSnapshotRequestBuilderGetRequestConfiguration struct { |
| 16 | + // Request headers |
| 17 | + Headers *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestHeaders |
| 18 | + // Request options |
| 19 | + Options []i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestOption |
| 20 | +} |
| 21 | + |
| 22 | +// NewConfigTriggerSnapshotRequestBuilderInternal instantiates a new TriggerSnapshotRequestBuilder and sets the default values. |
| 23 | +func NewConfigTriggerSnapshotRequestBuilderInternal(pathParameters map[string]string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter) *ConfigTriggerSnapshotRequestBuilder { |
| 24 | + m := &ConfigTriggerSnapshotRequestBuilder{ |
| 25 | + BaseRequestBuilder: *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewBaseRequestBuilder(requestAdapter, "{+baseurl}/admin/config/triggerSnapshot", pathParameters), |
| 26 | + } |
| 27 | + return m |
| 28 | +} |
| 29 | + |
| 30 | +// NewConfigTriggerSnapshotRequestBuilder instantiates a new TriggerSnapshotRequestBuilder and sets the default values. |
| 31 | +func NewConfigTriggerSnapshotRequestBuilder(rawUrl string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter) *ConfigTriggerSnapshotRequestBuilder { |
| 32 | + urlParams := make(map[string]string) |
| 33 | + urlParams["request-raw-url"] = rawUrl |
| 34 | + return NewConfigTriggerSnapshotRequestBuilderInternal(urlParams, requestAdapter) |
| 35 | +} |
| 36 | + |
| 37 | +// Get triggers the creation of a snapshot of the internal database for compatible storages.This operation can fail for the following reasons:* A server error occurred (HTTP error `500`) |
| 38 | +func (m *ConfigTriggerSnapshotRequestBuilder) Get(ctx context.Context, requestConfiguration *ConfigTriggerSnapshotRequestBuilderGetRequestConfiguration) ([]byte, error) { |
| 39 | + requestInfo, err := m.ToGetRequestInformation(ctx, requestConfiguration) |
| 40 | + if err != nil { |
| 41 | + return nil, err |
| 42 | + } |
| 43 | + errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings{ |
| 44 | + "500": i00eb2e63d156923d00d8e86fe16b5d74daf30e363c9f185a8165cb42aa2f2c71.CreateErrorFromDiscriminatorValue, |
| 45 | + } |
| 46 | + res, err := m.BaseRequestBuilder.RequestAdapter.SendPrimitive(ctx, requestInfo, "[]byte", errorMapping) |
| 47 | + if err != nil { |
| 48 | + return nil, err |
| 49 | + } |
| 50 | + if res == nil { |
| 51 | + return nil, nil |
| 52 | + } |
| 53 | + return res.([]byte), nil |
| 54 | +} |
| 55 | + |
| 56 | +// ToGetRequestInformation triggers the creation of a snapshot of the internal database for compatible storages.This operation can fail for the following reasons:* A server error occurred (HTTP error `500`) |
| 57 | +func (m *ConfigTriggerSnapshotRequestBuilder) ToGetRequestInformation(ctx context.Context, requestConfiguration *ConfigTriggerSnapshotRequestBuilderGetRequestConfiguration) (*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) { |
| 58 | + requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformationWithMethodAndUrlTemplateAndPathParameters(i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.GET, m.BaseRequestBuilder.UrlTemplate, m.BaseRequestBuilder.PathParameters) |
| 59 | + if requestConfiguration != nil { |
| 60 | + requestInfo.Headers.AddAll(requestConfiguration.Headers) |
| 61 | + requestInfo.AddRequestOptions(requestConfiguration.Options) |
| 62 | + } |
| 63 | + requestInfo.Headers.TryAdd("Accept", "application/json") |
| 64 | + return requestInfo, nil |
| 65 | +} |
| 66 | + |
| 67 | +// WithUrl returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. |
| 68 | +func (m *ConfigTriggerSnapshotRequestBuilder) WithUrl(rawUrl string) *ConfigTriggerSnapshotRequestBuilder { |
| 69 | + return NewConfigTriggerSnapshotRequestBuilder(rawUrl, m.BaseRequestBuilder.RequestAdapter) |
| 70 | +} |
0 commit comments